Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Flag for Zambia asked on

Me.Requery

I'm now failing to understand this requery property, see the definition below:

Me.Requery forces the entire recordset (underlying data) for the form to reload. This means ALL of the records in your current form will reload. Your current position will be lost, so if you're sitting on record 10 of 100, you'll find yourself back on the first record. Me.Requery is essentially the same as closing and reopening the form. Any new records added by other concurrent users will be available. Likewise any records that have been deleted will disappear. Requery essentially "re-runs the query" that pulled the data into the form in the first place. You can also use requery to update the data in a list box or combo box.

As per above definition is there a difference with the below combination:

Private Sub Refresh_Click()
DoCmd.Save
DoCmd.Close
DoCmd.Opern Form "XXXXXX"
End Sub

Can somebody out clear me on this

Regards

Chris
Microsoft Access

Avatar of undefined
Last Comment
ste5an

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jim Dettman (EE MVE)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ste5an

Sure, there is a difference. Cause one of your assumptions is wrong:

Me.Requery is essentially the same as closing and reopening the form
Closing and reopening can lose more information than a Requery. E.g. form level variables or filters.

And much more: a requery does only raise one event (On Current), whereas closing and reopening would raise a whole bunch of them. Where each event may have effects.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck