You can use the AllowBypassKey property to specify whether the SHIFT key is enabled for bypassing the startup properties and the AutoExec macro. For example, you can set the AllowBypassKey property to False to prevent a user from bypassing the startup properties and the AutoExec macro.

Setting

The AllowBypassKey property uses the following settings.

Setting

Description

True

Enable the SHIFT key to allow the user to bypass the startup properties and the AutoExec macro.

False

Disable the SHIFT key to prevent the user from bypassing the startup properties and the AutoExec macro.

You can set this property by using a macro or Visual Basic for Applications (VBA) code.

To set the AllowBypassKey property by using a macro or Visual Basic for Applications (VBA) code, you must create the property in the following ways:

  • In a Microsoft Access database (.mdb or .accdb), you can add the property by using the CreateProperty method and then appending it to the Properties collection of the Database object.

  • In a Microsoft Access project (.adp), you can add the property to the AccessObjectProperties collection of the CurrentProject object by using the Add method.

Remarks

You should make sure the AllowBypassKey property is set to True when you debug an application.

The AllowBypassKey property's setting doesn't take effect until the next time the application database opens.

Example

The following example shows a procedure named SetBypassProperty that passes the name of the property to be set, its data type, and the setting. The general purpose procedure ChangeProperty attempts to set the AllowBypassKey property and, if the property isn't found, uses the CreateProperty method to append the property to the Properties collection. This is necessary because the AllowBypassKey property doesn't appear in the Properties collection until it has been added.

Sub SetBypassProperty()Const DB_Boolean As Long = 1    ChangeProperty "AllowBypassKey", DB_Boolean, FalseEnd SubFunction ChangeProperty(strPropName As String, _    varPropType As Variant, _    varPropValue As Variant) As Integer    Dim dbs As Object, prp As Variant    Const conPropNotFoundError = 3270    Set dbs = CurrentDb    On Error GoTo Change_Err    dbs.Properties(strPropName) = varPropValue    ChangeProperty = TrueChange_Bye:    Exit FunctionChange_Err:    If Err = conPropNotFoundError Then ' Property not found.        Set prp = dbs.CreateProperty(strPropName, _            varPropType, varPropValue)        dbs.Properties.Append prp        Resume Next    Else        ' Unknown error.        ChangeProperty = False        Resume Change_Bye    End IfEnd Function

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.