Application object in class module

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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)
 
Back
Top