ON Exit Event

S

SUB

does anyone know a way of halting access when the ON_EXIT
event occurrs, until your specified code has finished. I
have setup a database with vb code in the ON_EXIT event
but when the user close the close button on Access it just
closes the db and doesn't wait to finish the code????

cheers in Advance

SUB
 
G

Guest

One possible way migth be to include in the first code a
line that disables the close button (maybe something like
Me.CloseButtom = 0), and then at the end of the code re-
enable it (= -1). If you do chose this, though, make sure
to include some sort of MsgBox that tells the user what's
going on.
 
W

Wayne Morgan

When you open Access, open a hidden form. In the UnLoad event of this form,
check for the value of a Global variable that you have created to use as a
"flag". If the value is False, Cancel the close (set Cancel = True). Set the
value of this variable at the start of your procedures to False and to True
at the end of the procedures to allow a shutdown.

Example:
Cancel = Not OkToShutdown

This will make Cancel = True if OkToShutdown = False.
 
J

JimH

-----Original Message-----
does anyone know a way of halting access when the ON_EXIT
event occurrs, until your specified code has finished. I
have setup a database with vb code in the ON_EXIT event
but when the user close the close button on Access it just
closes the db and doesn't wait to finish the code????

cheers in Advance

SUB
.
Sounds like on exit not being triggered - either move
focus or put your code in the unload event
 

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