Preventing application closedown by X button

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.
 
P

pvp

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.
 
J

Jeff Conrad

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
 
J

Jamie

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.
 

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