• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 52
  • Last Modified:

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
0
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Asked:
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Well outside of the fact that your going through all the other steps (closing the form, opening, re-creating controls, etc), then no.

 In both cases, you would have a fresh recordset.

 What's your concern/problem?

Jim.
0
 
ste5anSenior DeveloperCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now