Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run a sub whenever access closes

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
US
Is it possible to run a certain sub whenever the .mdb starts to close? I understand that I can attach code to my quit button, but they might also quit by using the "x" in the app window's upper right corner.

In vba, is there a way to abort the close?
 
basically, I want the opposite of an autoExec macro. It should run whenever accesss closes.
 
You can disable the X. But that still leaves File>Exit.
 
I don't think there is such an event, but as a work around you can have a form which is invisible and is open at the start, then use this form's close event...

--------------------
Procrastinate Now!
 
In the few minutes since I asked this question, I found the invisible form trick. But Crowley, what code do I use to abort the shutdown? The threads I found say that "Cancel=True" does it. Unfortunately that does not seem to work for me. :(
 
Oh wait....I put my code in the close property. When I put it in Form_Unload, it worked. So I may have solved the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top