Access Close Code

  • Thread starter Thread starter Gerry
  • Start date Start date
G

Gerry

Is there a way to either deactivate or else add code to
the close button in Access XP

My end users are closing the database by using the close
button for Access instead of using the custom command
button I have created. When they use the close button
maintanence code does not run.

Any guidance would be appreciated.

Thanks
 
When you open Access, open a hidden form. In the Unload event of this form,
check for the value of a global "flag" variable you have created. If the
value isn't what was expected, set Cancel = True to cancel closing this
form. You may even want to pop-up a message box explaining the problem. When
you close the form the way you desire, set the value of the variable so that
the Cancel isn't triggered.
 
Excellent, thanks Wayne.
-----Original Message-----
When you open Access, open a hidden form. In the Unload event of this form,
check for the value of a global "flag" variable you have created. If the
value isn't what was expected, set Cancel = True to cancel closing this
form. You may even want to pop-up a message box explaining the problem. When
you close the form the way you desire, set the value of the variable so that
the Cancel isn't triggered.

--
Wayne Morgan
Microsoft Access MVP





.
 
Or, Just have this hidden form actually DO the maintenance you want to
accomplish. That way, the maintenance code runs whichever way the user
closes Access.

-Tom
 
Back
Top