Understanding and Managing Microsoft Access Shift Bypass

Microsoft Access Shift Bypass is a feature that allows users to open an Access database without running startup options or AutoExec macros. This functionality can be crucial for developers and administrators but may pose security risks in deployed applications.
 

How Shift Bypass Works

When opening a Microsoft Access database, users can hold down the SHIFT key to bypass startup properties and the AutoExec macro. This feature is particularly useful for troubleshooting and accessing databases that might have errors in their startup code.
 

 

Disabling The Shift Bypass Via the AllowBypassKey Database Property

By default, Shift Bypass is enabled on all Microsoft Access databases.  However, it is possible to disable this functionality by setting the AllowBypassKey database property.

Sadly, the AllowBypassKey property is not accesible in any manner via the GUI and must be configure via VBA code.

The AllowBypassKey property is a boolean property where:

Property Value Effect Description
True SHIFT Bypass is allowed/enable (unsecured)
Default state of an Access database
False SHIFT Bypass is disabled (secured)

Determining the Current AllowBypassKey Property Value

To validate the current AllowBypassKey property value for the current database we can simply do something like:

Function Local_GetAllowBypassKey() As Boolean
    Dim oDb                   As DAO.Database

    On Error GoTo Error_Handler

    Set oDb = CurrentDb
    Local_GetAllowBypassKey = oDb.Properties("AllowBypassKey")

Error_Handler_Exit:
    On Error Resume Next
    Set oDb = Nothing
    Exit Function

Error_Handler:
    If Err.Number = 3270 Then    ' Property not found
        Local_GetAllowBypassKey = True    'If not set, it is allowed/True
    Else
        MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
               "Error Source: Local_GetAllowBypassKey" & vbCrLf & _
               "Error Number: " & Err.Number & vbCrLf & _
               "Error Description: " & Err.Description & _
               Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
               , vbOKOnly + vbCritical, "An Error has Occurred!"
    End If
    Resume Error_Handler_Exit
End Function

remembering the fact that if the property does not exists, then that is the same as having it set to True.

Setting the AllowBypassKey Property Value

Should we wish to set the value, then we can modify the above to something more like:

Sub Local_SetAllowBypassKey(bAllowBypassKey As Boolean)
    Dim oDb                   As DAO.Database
    Dim oProp                 As DAO.Property

    On Error GoTo Error_Handler

    Set oDb = CurrentDb
    oDb.Properties("AllowBypassKey") = bAllowBypassKey

Error_Handler_Exit:
    On Error Resume Next
    Set oProp = Nothing
    Set oDb = Nothing
    Exit Sub

Error_Handler:
    If Err.Number = 3270 Then    ' Property not found, so create it and add it to the db
        Set oProp = oDb.CreateProperty("AllowBypassKey", dbBoolean, bAllowBypassKey)
        oDb.Properties.Append oProp
    Else
        MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
               "Error Source: Local_SetAllowBypassKey" & vbCrLf & _
               "Error Number: " & Err.Number & vbCrLf & _
               "Error Description: " & Err.Description & _
               Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
               , vbOKOnly + vbCritical, "An Error has Occurred!"
    End If
    Resume Error_Handler_Exit
End Sub

Where to disable the SHIFT Bypass and ‘secure’ your database before distribution to your end-users, we would simply do:

Local_SetAllowBypassKey False

and to re-enable the SHIFT Bypass, we would do:

Local_SetAllowBypassKey True

 

SHIFT Bypass Property Setting Utility

A while back I created a utility so I could manage this property remotely for various databases. Thus, I adapted the above code to work with remote databases and created a simple form to select and manage the property from:

I’ve recently polished it up a bit and provide it below for your usage.

Disclaimer/Notes:

If you do not have Microsoft Access, simply download and install the freely available runtime version (this permits running MS Access databases, but not modifying their design):

Microsoft Access 2010 Runtime
Microsoft Access 2013 Runtime
Microsoft Access 2016 Runtime
Microsoft 365 Access Runtime

All code samples, download samples, links, ... on this site are provided 'AS IS'.

In no event will Devhut.net or CARDA Consultants Inc. be liable to the client/end-user or any third party for any damages, including any lost profits, lost savings or other incidental, consequential or special damages arising out of the operation of or inability to operate the software which CARDA Consultants Inc. has provided, even if CARDA Consultants Inc. has been advised of the possibility of such damages.

Download a Demo Database

Feel free to download a 100% unlocked demo (accdb) copy by using the link provided below:

Download “SHIFT Bypass Property Setting Utility” ShiftBypass.zip – Downloaded 4546 times – 101.77 KB

Also note that although the demo database is an accdb file, the exact same form/code will equally work in an mdb file and it can interact with mdb files as is.

 

Final Thoughts

It’s important to note that while disabling Shift Bypass can deter casual users from bypassing startup options, it’s not a comprehensive security solution. Determined users with sufficient knowledge may still find ways to circumvent these restrictions by re-enabling the property.

So, while the Shift Bypass feature in Microsoft Access is a valuable tool for developers, it is not a foolproof means and should be part of a larger security approach.
 

Resources On The Subject

 

Page History

Date Summary of Changes
2025-02-06 Initial Release

5 responses on “Understanding and Managing Microsoft Access Shift Bypass

  1. Stephen Layton

    Daniel
    Your generosity in allowing free access to this incredibly useful utility is really appreciated.

    I’m discovering significantly more useful ways of utilising VBA through your DevHut web site and watching the YouTube videos. Your time in sharing your development skills does not go underestimated and I am most grateful.

  2. Reno Holland

    What a great utility this is. I already put it to good use.

    Thank you so much Daniel.

    Reno