Application object in class module

L

Leon

In my Access application, I want users to quit only through the main menu.
How can I trap the close event if user closes Access using File/Close, rather
than the user menu, which has a DoCmd.Quit?

In Excel, you can create an application object using WithEvents in a class
module. It does not seem to work in Access.

Is this possible?
 
D

Douglas J. Steele

Have a form that's always open (it doesn't have to be visible). Put code in
that form's Unload event to set Cancel = True unless your conditions have
been met. (For instance, set a global variable or something when they use
the menu to quit so that the Unload event knows that it's okay to quit)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top