Here is a function to do just that.
Disable ByPass Key
This function only needs to be run once for each database to set the AllowByPassKey property. The documented syntax for creating and setting properties in the Access Help file is CreateProperty(PropertyName, PropertyType, PropertyValue, DDL) syntax. However, any knowledgeable user can run code to reverse the AllowByPassKey setting. In order to prevent users from reversing the property setting, you must set the fourth (DDL) parameter to True: CreateProperty(PropertyName, PropertyType, PropertyValue, True). The following function can be run from another database or from the Debug/Immediate window.
Function faq_DisableShiftKeyBypass(strDBName as String, fAllow as Boolean) As Boolean
On Error GoTo errDisableShift
Dim ws As Workspace
Dim db As DATABASE
Dim prop As Property
Const conPropNotFound = 3270
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(strDBName)
db.Properties("AllowByPassKey") = Not fAllow
faq_DisableShiftKeyBypass = fAllow
exitDisableShift:
Exit Function
errDisableShift:
'The AllowBypassKey property is a user-defined
' property of the database that must be created
' before it can be set. This error code will execute
' the first time this function is run in a database.
If Err = conPropNotFound Then
' You must set the fourth DDL parameter to True
' to ensure that only administrators
' can modify it later. If it was created wrongly, then
' delete it and re-create it correctly.
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, False, True)
db.Properties.Append prop
Resume
Else
MsgBox "Function DisableShiftKeyBypass did not complete successfully."
Faq_DisableShiftKeyBypass = False
GoTo exitDisableShift
End If
End Function