Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop users from closing MS Access

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
US
I want to prevent users from quitting my Access database unless they use my quit button or hit ctrl-alt-delete. I have already suppressed all of the normal menus and toolbars. So really I need help with two questions:

1. All Windows apps have an x in the upper right corner. Clicking this x closes the application. How can I stop users from x-ing out of my application?

2. How can I stop users from using ctrl-w to quit?
 
I just figured out the answer to my first question! If a form is always open in the foreground, and its close button property is set to false, then that stops them from "x-ing" out of the application.

But I still want to suppress ctrl-q. How do I do that?
 
There is an FAQ about this:
KISS way to force users to click a command button to exit a form regardless of menu or toolbar options

You mention that a form is always open, therefore you can force the user to click your close button:

Code:
Option Compare Database
Public blnOKToClose

Private Sub cmdClose_Click()

    blnOKToClose = True
    DoCmd.Close

End Sub

Private Sub Form_Unload(Cancel As Integer)
If Not blnOKToClose Then
    Cancel = True
End If

End Sub
 
Dev Ashish (the Access Web) provided one method of preventing Access from closing: General: Prevent Access from closing
.

I used a technique provided by Calvin Smith that disables the Access container's Control box and [X]. It even disables the close option from the task bar icon. Alas, I couldn't find the code from his site, but I did find a couple of posts that uses the same code: Prevent Closing Access with the X by mistake. I've used this on a couple of databases that needed protection from users who were known to be a bit free with the mouse. It's saved quite a few people from closing the database prematurely. You can still close the database using Alt+F4, but it does prevent them from hitting that [X].

HTH,
Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top