Can't find QueryClose Event

MartyL354

MartyL
Local time
Yesterday, 21:54
Joined
Jan 12, 2009
Messages
14
The online Access Developer Help for Access 2007 shows a "QueryClose Event". It is not an available event on forms in my Access 2007 application. Is this a real event in VBA or is this erroneous information?

It is exactly what I am looking for. It has two parameters. One is to Cancel the Close event and the other tells you what triggered the close (the X on the form, Your Code, etc.) I need to make code run on my form when the user closes it. It works fine in my code when they click my "Exit" command button but not if they close it with the X. I can probably figure out how to accomplish this but I am used to using the QueryClose event in VB6 as it is so convenient and would be really nice to have in VBA. Is there some setting that makes it available or something?

Thanks much,

Marty
 
Marty,

I think want you might be looking for is the form's On Unload event:

Code:
Private Sub Form_Unload(Cancel As Integer)

End Sub

Without know more about what you want to do, I an not sure is this is the correct event.
 
You may find that QueryUnload is a Visual Basic event not available in Access.
 
Sorry, I meant QueryUnload in VB6. I was just hoping the QueryClose event was there in Access because they do show it in the online Access 2007 help file.
 
Can't comment on 07 yet to develop in that version yet.
 
I haven't used this event either. To determine if it will work for you, put message boxes in the event to display the values. You will see if they are different depending on how the form is closed.
 
I can't test the event because it isn't even available (as in doesn't show up in the list of available events) in my installation of Access 2007.

Is it available in other versions of Access?
 

Users who are viewing this thread

Back
Top Bottom