Preventing application closedown by X button

  • Thread starter Thread starter pvp
  • Start date Start date
P

pvp

I have looked into the obejct viewer and the help and
cannot find anything obvious. So...

How can I specify in an Access 2002(XP) application that
I only want it to closedown via VBA code hanging on a
button in one of its forms? Not the red X at the top
right corner.

And as supplementary question: has anyone written an
comprehensible book on the Access object set and its
methods and properties, arranged by use rather than
alphabetically?

Many thanks.
 
Thank you but this is not quite what i was asking for...

I know how to close an application with quit. What I need
to know is how to stop people closing the application by
using the red X button (top-right of the window) and
instead force them into my VBA closure code, which will
be hanging on a button in my switchboard form.

Can you help further?

Thanks.
 
Hi,

I use these techniques. They work great.
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
 
Hi PVP

If you have a form that is constantly loaded in your application (visible or
not) you can enter code in the Form_Unload event to cancel it. This will
effectively stop users from closing Access (unless they resort to killing
Access' process). Something as simple as:

Private Sub Form_Unload(Cancel As Integer)
Cancel = True
End Sub


will do the job, but I imagine you will want to be more thorough than that.
 
Back
Top