By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,929 Members | 634 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,929 IT Pros & Developers. It's quick & easy.

Shift Bypass Enable/Disable Password Protection

P: 17
I have a code for enabling a command button to password protect the enabling/disabling of the Shift bypass. For some reason though I keep recieving a syntax error when I try to use it. I copied the code from the following link: http://www.databasedev.co.uk/disable_shift_bypass.html It seems to have a problem with the part that reads:
MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
"The Shift key will allow the users to bypass the startup & _
options the next time the database is opened.", _
vbInformation, "Set Startup Properties"
I did not really understand the first part of the directions about setting my references, so I don't know if that is the reason it is failing?

Any comments would be greatly appreciated.

Thanks.

Here is my full code behind the command button:

Expand|Select|Wrap|Line Numbers
  1.  
  2. On Error GoTo Err_bDisableBypassKey_Click
  3. 'This ensures the user is the programmer needing to disable the Bypass Key
  4. Dim strInput As String
  5. Dim strMsg As String
  6. Beep
  7. strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
  8. "Please key the programmer's password to enable the Bypass Key."
  9. strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
  10. If strInput = "burlington" Then
  11. SetProperties "AllowBypassKey", dbBoolean, True
  12. Beep
  13. MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
  14. "The Shift key will allow the users to bypass the startup & _
  15. options the next time the database is opened.", _
  16. vbInformation, "Set Startup Properties"
  17. Else
  18. Beep
  19. SetProperties "AllowBypassKey", dbBoolean, False
  20. MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
  21. "The Bypass Key was disabled." & vbCrLf & vbLf & _
  22. "The Shift key will NOT allow the users to bypass the & _
  23. startup options the next time the database is opened.", _
  24. vbCritical, "Invalid Password"
  25. Exit Sub
  26. End If
  27. Exit_bDisableBypassKey_Click:
  28. Exit Sub
  29. Err_bDisableBypassKey_Click:
  30. MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
  31. Resume Exit_bDisableBypassKey_Click
  32.  
  33. End Sub
  34.  
Jun 14 '07 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
You were having problems with your message boxes. They should work find with the following ammendments ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. On Error GoTo Err_bDisableBypassKey_Click
  3. 'This ensures the user is the programmer needing to disable the Bypass Key
  4. Dim strInput As String
  5. Dim strMsg As String
  6.     Beep
  7.     strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
  8.     "Please key the programmer's password to enable the Bypass Key."
  9.     strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
  10.     If strInput = "burlington" Then
  11.         SetProperties "AllowBypassKey", dbBoolean, True
  12.         Beep
  13.         MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
  14.         "The Shift key will allow the users to bypass the startup " & _
  15.         "options the next time the database is opened.", vbInformation, "Set Startup Properties"
  16.     Else
  17.         Beep
  18.         SetProperties "AllowBypassKey", dbBoolean, False
  19.         MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
  20.         "The Bypass Key was disabled." & vbCrLf & vbLf & _
  21.         "The Shift key will NOT allow the users to bypass the " & _
  22.         "startup options the next time the database is opened.", _
  23.         vbCritical, "Invalid Password"
  24.         Exit Sub
  25.     End If
  26. Exit_bDisableBypassKey_Click:
  27.     Exit Sub
  28. Err_bDisableBypassKey_Click:
  29.     MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
  30.     Resume Exit_bDisableBypassKey_Click
  31. End Sub
  32.  
Jun 14 '07 #2

P: 17
Works like a charm!

Thank you so much Mary for your continued expertise!


You were having problems with your message boxes. They should work find with the following ammendments ...

Expand|Select|Wrap|Line Numbers
  1.  
  2. On Error GoTo Err_bDisableBypassKey_Click
  3. 'This ensures the user is the programmer needing to disable the Bypass Key
  4. Dim strInput As String
  5. Dim strMsg As String
  6.     Beep
  7.     strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
  8.     "Please key the programmer's password to enable the Bypass Key."
  9.     strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
  10.     If strInput = "burlington" Then
  11.         SetProperties "AllowBypassKey", dbBoolean, True
  12.         Beep
  13.         MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
  14.         "The Shift key will allow the users to bypass the startup " & _
  15.         "options the next time the database is opened.", vbInformation, "Set Startup Properties"
  16.     Else
  17.         Beep
  18.         SetProperties "AllowBypassKey", dbBoolean, False
  19.         MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
  20.         "The Bypass Key was disabled." & vbCrLf & vbLf & _
  21.         "The Shift key will NOT allow the users to bypass the " & _
  22.         "startup options the next time the database is opened.", _
  23.         vbCritical, "Invalid Password"
  24.         Exit Sub
  25.     End If
  26. Exit_bDisableBypassKey_Click:
  27.     Exit Sub
  28. Err_bDisableBypassKey_Click:
  29.     MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
  30.     Resume Exit_bDisableBypassKey_Click
  31. End Sub
  32.  
Jun 22 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Works like a charm!

Thank you so much Mary for your continued expertise!
You're welcome.
Jun 22 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.