Updating a unbound Textbox from an updated unbound textbox without focus (1 Viewer)

l3on

New member
Local time
Tomorrow, 00:58
Joined
May 26, 2008
Messages
8
I have searched for a solution to my problem but have been unable to find any pointers or assistance. I currently have a form that has 2 text boxes in the main form and a subform that contains the record data, the subform datasheet displays multiple records.

The first textbox displays the average value of the records. This uses a (hidden) textbox in the subform footer with a control source =Avg([Data]). The mainform textbox's control source references the subform footer textbox.

My problem is with the second textbox on the mainform. Its purpose is to display a pass/fail based on the value of the first textbox. So, as the data in the subform is updated, the average value in the mainform textbox changes and this intern recalculates if the 2nd textbox should be a "Pass or Fail". I have the code inplace to update the second textbox but I have not found the correct event to trigger the update.

I originally placed the 2nd textbox code on a AfterUpdate for the first textbox. But I believe that because the user does not initiate the first textboxes change of value directly, the afterupdate event is not called. Which event should I be using, and on what control should I be placing the event.

Thankyou for your assistance.
 

DCrake

Remembered
Local time
Today, 16:28
Joined
Jun 8, 2005
Messages
8,632
Simple Software Solutions

When you move from one record to another use the OnCurrent Property of the main form and...

Me.Requery
 

l3on

New member
Local time
Tomorrow, 00:58
Joined
May 26, 2008
Messages
8
Thank you for your reply.

When you move from one record to another use the OnCurrent Property of the main form and...
Me.Requery

I've used the main form OnCurrent Property, and it does update the 'textbox2' with the required information. However there is a long delay !10seconds when starting the form, or trying to change a mainform record.
Is there a simple way to overcome this.
 

DCrake

Remembered
Local time
Today, 16:28
Joined
Jun 8, 2005
Messages
8,632
Simple Software Solutions

The time delay is due to the amount of activity taking place within the form. If you are using a large query or table as the rowsource and have a lot of sub queries or dlookups taking place the Me.Requery reestablishes all the actions every time. You could try Me.TextControl.Requery.

David
 

l3on

New member
Local time
Tomorrow, 00:58
Joined
May 26, 2008
Messages
8
Focusing the requery on the specific textbox worked a treat. Cheers.
 

l3on

New member
Local time
Tomorrow, 00:58
Joined
May 26, 2008
Messages
8
The form was working with the default form settings.
But now that I have changed the layout, removing record navigation toolbar and forced the form to a new record OnLoad() textbox2 does not update. What would I be missing, I'm presuming that now that there can be only 1 record the OnCurrent event is void.

I've also noticed this does the same if selection 'DataEntry'.
 

Users who are viewing this thread

Top Bottom