Refresh Form

JPR

Registered User.
Local time
Yesterday, 16:04
Joined
Jan 23, 2009
Messages
202
Hello,

I have a form with several controls like textboxes and combos.
I would like to refresh the form when data is changed or updated in any control.

I have placed the Me.requery on the after update event of the form but it seems it is not working.
Is there any other solution, you can suggest? Thank you
 
Entering text into a box should not warrant a refresh.
 
Hi. Just a guess, try Recalc.
 
Still nothing. This is exactly what I am trying to do, update a text box following data change in another textbox. Thanks
 
.....update a text box following data change in another textbox. Thanks
What is the Control Source for the textbox that you want to "update"?

Perhaps you just need to requery that text box with:
Me.NameOfTextbox.Requery
 
I have placed the Me.requery on the after update event of the form but it seems it is not working.
The AfterUpdate event of the form runs immediately AFTER a record is saved. There should be nothing to refresh at that time and requery just reruns the query which if you are using a continuous form will also reposition you to the first row in the list.

You should automatically see changes.
Code:
If Me.fld1 = True
    Then Me.fld2 = Now()
End If

There is one case where you won't see changes and that is if you have given the control a different name from the bound field or if you have been sloppy and left the control names as text89 or whatever.

If the Control Name and the ControlSource are not IDENTICAL, then if your code references the ControlSource, the field gets changed but you don't see it immediately. However if you reference the ControlName, you will. So:

Me.OrderDT = Now()
Me.txtOrderDT = Now()
Me.Text78 = Now()

If the controlSource = OrderDT but the ControlName = txtOrderDT or Text78, you have to use statement 2 or 3 if you want to see the change immediately. The first version won't work because Access keeps separate buffers for the control and the field if they have different names. Personally, I always rename my controls using prefixes such as txt, cbo, chk, etc. That way I can always tell in the code what I am referring to.
 

Users who are viewing this thread

Back
Top Bottom