Clearing out the data when the database is closed

R

RobertM

Hello:
I've placed a button on the database form that runs a macro that (1) turns
the warnings off (2) runs SQL code that deletes the data in the tables, and
(3) quits / closes Access.

I've set the startup options up so the average user will not be able to
access the tables, queries, etc.

What I would like to do is set this up so that if a user decides to exit the
database from the menu bar the data in the tables will delete as if they used
the close button that I had set up.

Thank you,
Robert
 
D

Douglas J. Steele

If the form's already open, you can put code in the form's Unload event to
call the code that's in the Close button.

If the form's not already open, and you want to ensure that this happens
regardless when they close the database, open up a form when you open the
database (the form can be hidden), and put the logic in that form's Unload
event.
 
Top