Validation Controls before Closing DB

G

Guest

I have several working tables that I want to ensure are empty before closing
the DB. I can currently enable or disable the DB exit process, and want to
install these checks before enabling the close and quit functions of the DB.
Is there a way to easily code this?
 
G

Guest

It is easier to ensure that the tables are empty when he mdb is loaded.

The mdb can be closed in different ways, and the worse is by shutting the
computer without closing the mdb first, so you can't ensure that the tables
will get empty.
but when the mdb open's, you can set it to run a form when it's load, and on
the OnLoad event of the form you can empty this tables, or by creating a
macro called AutoExec that run every time the mdb opens, and in the macro you
can set the delete command.
 
G

Guest

Unfortunately, having the computer look at the tables as the DB is opening is
not an appropriate option for the application I'm working on. I need the DB
to ask the user if they wish to save the data from the working tables, so
that the data is collected into the proper storage tables. Any other
suggestions?
 
G

Guest

Hi

Presumably users click on a command button to quit. In the button's 'On
Click' event try:

If MsgBox("Do you want to save the data?, vbyesno, "Save Data") = vbyes then
....run code to save data to storage table....
End If

DoCmd.RunSQL "DELETE * FROM tablename"

Quit
 
G

Guest

If you have a form that load when the MDB is run, and this form is open all
the time, smething like SwitchBoard, or a form that you use as a backgound,
in that case you can write the code in the UnLoad event of that form.
 
G

Guest

Thank you for telling me where it neds to be (actually had not worried about
that yet). Now is there a command or set of commands to have the computer
look into the table?
 
J

John Spencer

How about using the Dcount Function?

IF DCount("*","YourTableName") > 0 then
'Do something here.
 

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