Disable Alt-F4

cstanley

Registered User.
Local time
Today, 10:17
Joined
May 20, 2002
Messages
86
Hello all,

I would like to disable the close shortcut command - AltF4, so that users can't bypass security by simply closing out the form to get to the back end of the database... anyone know how to do this?

Thanks,

Chris
 
Set the "Key Preview" property of the form to Yes.

Now use the Form's "On Key Down" event to do what you ask:

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim intAltDown As Integer
intAltDown = (Shift And acAltMask) > 0

Select Case KeyCode
  Case vbKeyF4
    If intAltDown Then
      KeyCode = 0
      MsgBox "Alt+F4 has beed Disabled.", vbExclamation + vbOKOnly, " Disabled Key"
    End If
End Select
End Sub

HTH
RDH
 

Users who are viewing this thread

Back
Top Bottom