Sub KeepEmOut()
Dim db As Database
Dim pty As Property
On Error GoTo KeepEmOut_Err
Set db = CurrentDb
db.Properties("AllowBypassKey").Value = False
KeepEmOut_Exit:
Exit Sub
KeepEmOut_Err:
If Err.Number = 3270 Then 'Error code for "Property not found"...
'so we'll create it ourselves
Set pty = db.CreateProperty("AllowBypassKey", dbBoolean, False)
db.Properties.Append pty
Else
MsgBox Err.Description
Resume KeepEmOut_Exit
End If
End Sub
Related examples in the same category