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

Quit equivalent of Autoexec

Status
Not open for further replies.

Mudshark

Programmer
Sep 26, 2000
11
0
0
US
I know you can use the Autoexec function to execute any commands at start-up

Is there a corresponding way to assure that certain commands/procedures/functions are executed when the database is closed.

thanks for your time

Mudshark
 
Mud,

The way this is usually done is to open a form when your application starts up and keep it open the entire time the user is in the application. Then you can put code in the close or unload event of that form, so that the code will always run when the application is closed.

Most often this form is made invisible. It may be your switchboard form that just goes invisible instead of closing when you go to another form.

A nice benefit of this is that you can trap for users trying to close the application by closing Access, and force them to close the application in an orderly fashion. All you have to do is make it so that clicking the quit button on your switchboard form changes the value of a hidden control on that form, and the close/unload code you use to shut down the application doesn't allow you to close the form unless that invisible control has a particular value.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top