Hello,
I have the code below attached to 2 buttons on my databases Main Menu to disable/enable the bypass key. I also have a text box on the Main Menu named txtBypass that displays “True” or “False” depending on if the bypass is enabled or not. I recently converted this database from Access 2010 to Access 2013 and began getting the error “Property not found.” Can anyone tell me why? I have attached a doc with the code below and picture of the Main Menu.
Thank you for your help.
Disable Button Code
Private Sub cmdDisable_Click()
On Error Resume Next
Dim DB As DAO.Database
Dim PR As DAO.Property
Set DB = CurrentDb
Set PR = DB.CreateProperty("AllowBypassKey", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowBypassKey") = False
Set PR = DB.CreateProperty("AllowSpecialKeys", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowSpecialKeys") = False
Set PR = DB.CreateProperty("AllowFullMenus", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowFullMenus") = False
Set PR = DB.CreateProperty("AllowDefaultShortcutMenus", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowDefaultShortcutMenus") = False
Set DB = Nothing
MsgBox "Bypass Key Disabled"
End Sub
Enable Button Code
Private Sub cmdEnable_Click()
On Error Resume Next
Dim DB As DAO.Database
Dim PR As DAO.Property
Set DB = CurrentDb
Set PR = DB.CreateProperty("AllowBypassKey", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowBypassKey") = True
Set PR = DB.CreateProperty("AllowSpecialKeys", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowSpecialKeys") = True
Set PR = DB.CreateProperty("AllowFullMenus", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowFullMenus") = True
Set PR = DB.CreateProperty("AllowDefaultShortcutMenus", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowDefaultShortcutMenus") = True
Set DB = Nothing
MsgBox "Bypass Key Enabled"
End Sub
Text Box Code:
Private Sub Form_Load()
txtBypass.Value = CurrentDb.Properties("AllowBypassKey")
End Sub
I have the code below attached to 2 buttons on my databases Main Menu to disable/enable the bypass key. I also have a text box on the Main Menu named txtBypass that displays “True” or “False” depending on if the bypass is enabled or not. I recently converted this database from Access 2010 to Access 2013 and began getting the error “Property not found.” Can anyone tell me why? I have attached a doc with the code below and picture of the Main Menu.
Thank you for your help.
Disable Button Code
Private Sub cmdDisable_Click()
On Error Resume Next
Dim DB As DAO.Database
Dim PR As DAO.Property
Set DB = CurrentDb
Set PR = DB.CreateProperty("AllowBypassKey", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowBypassKey") = False
Set PR = DB.CreateProperty("AllowSpecialKeys", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowSpecialKeys") = False
Set PR = DB.CreateProperty("AllowFullMenus", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowFullMenus") = False
Set PR = DB.CreateProperty("AllowDefaultShortcutMenus", dbBoolean, False)
DB.Properties.Append PR
DB.Properties("AllowDefaultShortcutMenus") = False
Set DB = Nothing
MsgBox "Bypass Key Disabled"
End Sub
Enable Button Code
Private Sub cmdEnable_Click()
On Error Resume Next
Dim DB As DAO.Database
Dim PR As DAO.Property
Set DB = CurrentDb
Set PR = DB.CreateProperty("AllowBypassKey", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowBypassKey") = True
Set PR = DB.CreateProperty("AllowSpecialKeys", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowSpecialKeys") = True
Set PR = DB.CreateProperty("AllowFullMenus", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowFullMenus") = True
Set PR = DB.CreateProperty("AllowDefaultShortcutMenus", dbBoolean, True)
DB.Properties.Append PR
DB.Properties("AllowDefaultShortcutMenus") = True
Set DB = Nothing
MsgBox "Bypass Key Enabled"
End Sub
Text Box Code:
Private Sub Form_Load()
txtBypass.Value = CurrentDb.Properties("AllowBypassKey")
End Sub