How can I disable the Microsoft Access close button?

G

Guest

When developing forms in Microsoft Access, I typically include a "Close"
button which enables me to perform housekeeping code when exiting a form. I
disable the close button [x] in the form's title bar so that the housekeeping
cannot be bypassed. However, I have not found a way to disable the button in
the Application title bar that exits Microsoft Access, consequently have had
problems with users "taking the easy way out" by quiting the application. I
am currently using version 2003, but have lived with this problem through all
versions since version 97.
Is there a way to disable the Microsoft Access close button?
 
R

Rick Brandt

Barry Daniell said:
When developing forms in Microsoft Access, I typically include a "Close"
button which enables me to perform housekeeping code when exiting a form. I
disable the close button [x] in the form's title bar so that the housekeeping
cannot be bypassed. However, I have not found a way to disable the button in
the Application title bar that exits Microsoft Access, consequently have had
problems with users "taking the easy way out" by quiting the application. I
am currently using version 2003, but have lived with this problem through all
versions since version 97.
Is there a way to disable the Microsoft Access close button?

You can open a hidden form at startup with the following code in its Unload
event.

If OkToClose = False Then
MsgBox "Please use my close button"
Cancel = True
End If

In your close button code...

OkToClose = True
DoCmd.Quit


You should however be able to simply put any house cleaning code in the
appropriate Close or Unload events of your forms and let the users utilize
the standard [X] boxes.
 
J

Jeff Conrad

Hi Barry,

I use these techniques. They work just fine.
Take your pick based on version.

ACC: How to Disable the Close Button (X) on the Access
Application Window (95/97)
http://support.microsoft.com/?id=258049

ACC2000: How to Disable the Close Button (X) on the Access
Application Window
http://support.microsoft.com/?id=245746

ACC2002: How to Disable the Close Button (X) on the Access
Application Window and the Exit Command on the File Menu
http://support.microsoft.com/?id=300688

Alternatively, take a look here:

http://www.mvps.org/access/general/gen0005.htm

Hope that helps,
 

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