How to Disable Alt+F11 (1 Viewer)

monfas

Registered User.
Local time
Today, 09:11
Joined
Jun 18, 2012
Messages
32
Hi,

I've looked for this around and didn't find. Wonder if someone can answer.

I've developed a database that is working fine, however, even when I have the Shift bypass key disabled, when the database is open, I can press Alt+F11 and will open all the code... so anyone can change it.

How can I disable this attachment.

I've seen this link for excel,

http://stackoverflow.com/questions/7324739/can-you-disable-the-vba-code-editor-window-in-excel-2010

however I'm not sure how to translate this to access in order for anytime anyone presses Alt+F11, this function to be called.

Thanks,
 

Mihail

Registered User.
Local time
Today, 09:11
Joined
Jan 22, 2011
Messages
2,373
Protect your code for viewing with a password.
Or distribute the FE as .mde (.accde)
 

pr2-eugin

Super Moderator
Local time
Today, 07:11
Joined
Nov 30, 2011
Messages
8,494
I second the option of ACCDE over password protection.. If you forget the password all is lost..
 

way2bord

Registered User.
Local time
Yesterday, 23:11
Joined
Feb 8, 2013
Messages
177
If you've disabled shift bypass, I assume you're running with automated startup forms.

On EVERY form, do the following:

KeyPreview = Yes

Event: OnKeyDown

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
 
 isAltDown = (Shift And acAltMask) > 0
 
    If isAltDown Then
        Select Case KeyCode
            Case Else
                KeyCode = 0
        End Select
    End If
End Sub

Adapt above to zero out keys you don't want pushed.

edit: As mentioned above, if you're trying to protect your code you should compile (accde) or password protect the VBA. Disabling Shift bypass is not database security.

If you're simply ensuring that people don't accidentally break things, the above will prevent them from accidentally hitting a key and popping open the editor.
 

Users who are viewing this thread

Top Bottom