below is actually the code I am using. I checked and the DAO property is there and checked.
Option Compare Database
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant)
'enables/disables database property such as shift-lock key
Dim dbs As DAO.Database, prp As DAO.Property
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_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 If
End Function
Function SetStartupProperties()
'Disallows Shift Key privilege of bypassing startup procedures.
ChangeProperty "AllowBypassKey", dbBoolean, False
MsgBox "Shift Security Overide has been deactivated"
End Function
Public Function STD_OUTPUT_TO()
'menubar for output to ... dialog
On Error GoTo STD_OUTPUT_TO_Err
DoCmd.OutputTo acReport, "", "", "", False, ""
STD_OUTPUT_TO_Exit:
Exit Function
STD_OUTPUT_TO_Err:
'MsgBox Error$
Resume STD_OUTPUT_TO_Exit
End Function
Public Function print_dot_dot_dot()
'menu item for print...
On Error Resume Next
DoCmd.RunCommand acCmdPrint
End Function
Function UnDoShiftLock(Optional pw As String) As Integer
're -enables Shift Key privilege of bypassing startup procedures, if correct password entered.
Static Try As Integer
Dim PSW As String, PswOK As Integer
On Error Resume Next
PswOK = False
If Len(pw & "") = 0 Then
PSW = Trim(LCase(InputBox("Enter Password", "Password") & ""))
Else
PSW = Trim(LCase(pw))
End If
If PSW = "MYPASSWORD" Then
PswOK = True 'put your password here
MsgBox ("Shift Key Security Overide Complete - Please close the database and reopen holding the shift key to access back end.")
End If
If PSW = "suite950" Then
PswOK = True 'or here -- use lower case
MsgBox ("Shift Key Security Overide Complete - Please close the database and reopen holding the shift key to access back end.")
End If
Try = Try + 1
If Try > 4 Then DoCmd.Quit acQuitSaveAll '4 strikes and you are out
If Not PswOK Then
MsgBox "Invalid Password, Attempt: " & Try
UnDoShiftLock = False
Exit Function
End If
'call function to enable shiftlock
ChangeProperty "AllowBypassKey", dbBoolean, True
UnDoShiftLock = True
End Function