docmd.close runs query before form closes

Jhitch

Registered User.
Local time
Today, 20:38
Joined
Nov 26, 2002
Messages
42
I have an unbound form with 3 listboxes. The second listbox is bound to a query that gets a parameter from the first listboxs value list. It works fine. If i close the form from the "X" close buton or choose File - Close from the menubar it closes normally. I have a command button on the form that runs the docmd.close code - when this is used there is a message asking for the parameter from the query that the second listbox is bound to. So it is trying to run the query when the form is unloaded and is no longer got the listbox value.

If i step through the code in the debugger it closes the form normally. This is driving me crackers!
 

Users who are viewing this thread

Back
Top Bottom