Run query before closing database

A

Ann

I am using Access 2002. I have a user who needs to do Adhoc reporting and I
want to keep her out of my tables. I have a macro that runs on the AutoExec
to transfer the database tables from the original to a new database so she
can do whatever she wants to create reports. I also have a SQL that will
drop all the tables when it's run. I don't want the user to be responsible
for running this query. I just want it to run when she closes the database.
Is this possible? Is there something on close like the AutoExec on opening a
database? Thanks for the help.
 
M

Marshall Barton

Ann said:
I am using Access 2002. I have a user who needs to do Adhoc reporting and I
want to keep her out of my tables. I have a macro that runs on the AutoExec
to transfer the database tables from the original to a new database so she
can do whatever she wants to create reports. I also have a SQL that will
drop all the tables when it's run. I don't want the user to be responsible
for running this query. I just want it to run when she closes the database.
Is this possible? Is there something on close like the AutoExec on opening a
database?


Use the Unload event of an always open form. If you do not
have such a form, you can use the AutoExec macro to open a
small, invisible form when the database starts up.

BUT, there is no guarantee that the database will be closed.
E.g. power outage, pull the plug, task manager, etc. It is
much safer to clear it all the old data tables when the mdb
starts up, right before you import the data tables.
 
A

Ann

Hi,

Thanks! As obvious as that was to put it in the beginning instead of the
end and it just didn't occur to me. It worked great!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top