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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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,
 
Back
Top