DoCmd.Requery Not Available

AndreT

Registered User.
Local time
Today, 08:10
Joined
Mar 16, 2011
Messages
26
During debugging mode, sometimes the DoCmd.Requery is available, sometimes it's not and produce error 2046 "The command or action 'Requery' isn't available now". Can anyone shed some light on when and why?

Thanks for your help in advance.
 
Requery what? That's the problem. DoCmd.Requery does not specify an object, so unless the target object is totally clear, the command is not available.
 
Oh yes, I always use DoCmd.Requery "(controlname)", the (controname) is either a list, combo box, or a datasheet with a list of values based on user selection on the form.
 
Right, but if you use the name of a control--which is a string--it depends on context right? It's an implicit reference in that it depends on the scope in which the command is used. Contrast that with an explicit reference to an object. So you can use ...
Code:
DoCmd.Requery "foo"
... or ...
Code:
foo.Requery
One of those is more reliable. I avoid DoCmd.
Mark
 
Thanks! I'll change all my docmd.Requery to method Requery.
 

Users who are viewing this thread

Back
Top Bottom