access-vbaEnable/Disable Shift Key on DB Open


Remarks

This code will turn off the capability for a user to hold down the Shift key when opening a database to skip the default form opening and allow the user access to the Navigation Pane and VB Editor. In DB’s that you do not want users to have access to either of these (along with disabling the use of Special Keys in the Current Database Options), this code will help to keep the database locked down.

Generally, the below code is placed in it's own Module that can be named basEnableDisableShift module, but this is just a suggestion and you can place it in any module that you may already have.

In order to disable the Shift key, within your VB Editor screen, enter 'DisableShift' within your Immediate window and hit Enter. You will then receive a message advising that the Shift Key has been Disabled.

To re-enable the Shift key, you will once again need to return to the VB Editor screen, enter 'EnableShift' within your Immediate window and hit Enter. You will again receive a message in your Immediate window advising the Shift Key has been Enabled.

NOTE: This is not a fool proof way to enable and disable the Shift Key, but if you are deploying a database to users who are not proficient with MS Access and VBA, it should be helpful in preventing users from accessing the VB Editor and/or Navigation Pane within your database.