Hiding the Application's "X" (Quit Access)

A

Access101

Is there a way to hide the Application's "X" in the upper right that closes
the database so that users are compelled to use the Switchboard's EXIT menu
item?

Any help is appreciated.
 
G

George Nicholson

Is there a way to hide the Application's "X" in the upper right that
closes
the database so that users are compelled to use the Switchboard's EXIT
menu
item?

No but if your Switchboard is always open, you can make the X
ineffective....

Declare a module level variable (at the top of the Form module: after any
Option statements, before any procedures):
Private mbolOKtoClose as Boolean

In Form_Load:
mbolOKtoClose = False
(False is the default, so this is a bit redundant, but what the hey...)

In Form_Unload
If mbolOKtoClose = False then
MsgBox "Please use the 'Exit App' button on the switchboard"
Cancel = True
Exit Sub
End If

In cmdExit_Click: (your "Close Application" button)
mbolOKtoClose = True
DoCmd.Close acForm, Me.Name

Only by clicking your button will the switchboard be able to close/unload.
This won't necessarily prevent other forms from closing if the user presses
X, but it will keep the switchboard open (or any other "always open" form).

HTH,
 

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