Requery a form

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I have a form that the user can add or edit records. Once
they have added or edited the record, there is a command
button to take them to a related form. However, if they
make changes to the record, they don't appear in the
second form until you close the whole form and reopen it.
I've read information on the Requery method and I think
that is what I need to do, but I want the whole form to be
requeried and not just a specific control. Does anyone
have an example of what that code would look like? I know
how to code a specific control but I am struggling with
the code for the whole form. I'm assuming I'd want to
place the code in the After Update event of the form
properties. If this is not the best location, please let
me know. Thanks in advance for any advice that can be
given.
 
You can requery the form from anywhere in the code using

Me.Requery

You can do it in the AfterUpdate of the form, sounds like a good place
to me. To test whether requerying is what you need you can manually
requery the form, instead of re-opening it, by pressing F9 (I think).

Good luck,
Pavel
 
An alternative solution may just be to save the record
after any changes. If you create a save record button you
can easily steal the code from this and put into into the
AfterUpdate field.
 
Back
Top