ON Exit Event

  • Thread starter Thread starter SUB
  • Start date Start date
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
 
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.
 
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.
 
-----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
 
Back
Top