terminating Access

  • Thread starter Thread starter Robert M via AccessMonster.com
  • Start date Start date
R

Robert M via AccessMonster.com

Does anyone know how I could prevent - or warn - users from closing Access
2000 directly? I would prefer that they use my Exit button and associated
code so that I can execute my application clean up code and then close/exit
Access 'gracefully'.
 
The normal approach is to have a form that's always open (it can be hidden),
and to put logic in that form's Unload event so that unless certain
conditions have been met (such as setting a global variable when they click
on the Exit button), the code sets Cancel to True so that the form can't
unload.

On the other hand, you could simply put your cleanup code in that event.
 
Robert M via AccessMonster.com said:
Does anyone know how I could prevent - or warn - users from closing
Access
2000 directly? I would prefer that they use my Exit button and associated
code so that I can execute my application clean up code and then
close/exit
Access 'gracefully'.
Have your exit code run frm your form's Unload event - you can make use of
the Cancel property in an "Are you sure" message box. That way your code
will run regardless of how the form is closed.

HTH - Keith.
www.keithwilby.com
 
Thanks, Keith. I'll give your suggestion a try.

Keith said:
Have your exit code run frm your form's Unload event - you can make use of
the Cancel property in an "Are you sure" message box. That way your code
will run regardless of how the form is closed.

HTH - Keith.
www.keithwilby.com
 
Douglas, It looks like yours and Keith's suggestions are similar and should
work well. I will give it try. Thanks!
 
Robert M via AccessMonster.com said:
Douglas, It looks like yours and Keith's suggestions are similar and
should
work well. I will give it try. Thanks!
For some reason I don't see other people's posts until well after their
timestamp. I wouldn't have deemed a response from me necessary if I'd seen
Douglas' posting first. :o)
 
Back
Top