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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run code on DB Close 2

Status
Not open for further replies.

SiJP

Programmer
May 8, 2002
708
GB
If a user quits my database, clicks the exit or does file / close/Exit - is there a way to catch this and BEFORE exiting run a piece of code?

If so - how!

TIA

=================
 
i am allway run a hide form,the code want to run is put in form_close events.
 
Expanding on what Trynew suggested:
Open a form invisibly when the database starts up. In its Form_Close event procedure, put the code you need to run at shutdown. This code will be called whether the user selects File|Exit from the menu, closes the Access window, even if the user shuts down Windows without closing the database!

If you need to prevent the user from closing the database, use the Form_Unload event procedure instead. Its Cancel parameter can even be used to stop a close attempt during Windows shutdown--so be careful that you can always create the conditions that allow the close to succeed!

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top