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: -
-
On Error GoTo Err_bDisableBypassKey_Click
-
'This ensures the user is the programmer needing to disable the Bypass Key
-
Dim strInput As String
-
Dim strMsg As String
-
Beep
-
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
-
"Please key the programmer's password to enable the Bypass Key."
-
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
-
If strInput = "burlington" Then
-
SetProperties "AllowBypassKey", dbBoolean, True
-
Beep
-
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"
-
Else
-
Beep
-
SetProperties "AllowBypassKey", dbBoolean, False
-
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
-
"The Bypass Key was disabled." & vbCrLf & vbLf & _
-
"The Shift key will NOT allow the users to bypass the & _
-
startup options the next time the database is opened.", _
-
vbCritical, "Invalid Password"
-
Exit Sub
-
End If
-
Exit_bDisableBypassKey_Click:
-
Exit Sub
-
Err_bDisableBypassKey_Click:
-
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
-
Resume Exit_bDisableBypassKey_Click
-
-
End Sub
-
3 11701
You were having problems with your message boxes. They should work find with the following ammendments ... -
-
On Error GoTo Err_bDisableBypassKey_Click
-
'This ensures the user is the programmer needing to disable the Bypass Key
-
Dim strInput As String
-
Dim strMsg As String
-
Beep
-
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
-
"Please key the programmer's password to enable the Bypass Key."
-
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
-
If strInput = "burlington" Then
-
SetProperties "AllowBypassKey", dbBoolean, True
-
Beep
-
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"
-
Else
-
Beep
-
SetProperties "AllowBypassKey", dbBoolean, False
-
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
-
"The Bypass Key was disabled." & vbCrLf & vbLf & _
-
"The Shift key will NOT allow the users to bypass the " & _
-
"startup options the next time the database is opened.", _
-
vbCritical, "Invalid Password"
-
Exit Sub
-
End If
-
Exit_bDisableBypassKey_Click:
-
Exit Sub
-
Err_bDisableBypassKey_Click:
-
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
-
Resume Exit_bDisableBypassKey_Click
-
End Sub
-
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 ... -
-
On Error GoTo Err_bDisableBypassKey_Click
-
'This ensures the user is the programmer needing to disable the Bypass Key
-
Dim strInput As String
-
Dim strMsg As String
-
Beep
-
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
-
"Please key the programmer's password to enable the Bypass Key."
-
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
-
If strInput = "burlington" Then
-
SetProperties "AllowBypassKey", dbBoolean, True
-
Beep
-
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"
-
Else
-
Beep
-
SetProperties "AllowBypassKey", dbBoolean, False
-
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
-
"The Bypass Key was disabled." & vbCrLf & vbLf & _
-
"The Shift key will NOT allow the users to bypass the " & _
-
"startup options the next time the database is opened.", _
-
vbCritical, "Invalid Password"
-
Exit Sub
-
End If
-
Exit_bDisableBypassKey_Click:
-
Exit Sub
-
Err_bDisableBypassKey_Click:
-
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
-
Resume Exit_bDisableBypassKey_Click
-
End Sub
-
Works like a charm!
Thank you so much Mary for your continued expertise!
You're welcome.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: PerryC |
last post by:
I have search googles and there are hundreds of tips about
AllowByPassKey... however, none works for me... well, perhaps I am too
new to such high level functionality that it just does not make...
|
by: Ghulam |
last post by:
I am using an Access 2k ADP (Converted into ADE) front end and SQL 2K
on the backend. Although I taught pretty much myself into these
concept with the help of some publications and users group...
|
by: Susan Bricker |
last post by:
I know that I saw some information concerning the <shift>+<enter>
combination use to bypass launching an Access mdb application and enter
the Access design workspace. Would someone please direct...
|
by: Paul T. RONG |
last post by:
Dear All,
I add two new tables to the database and then the disable shift key codes
don't work. These two new tables are actually created by two queries, and
only these two are in the front end,...
|
by: tdmailbox |
last post by:
I set up my code to disable the shift bypass however for certain users
I want to allow them through a button no a form to be able open up the
list of tablies and queries.
Is there a vb command...
|
by: simonmarkjones |
last post by:
Hi i'm trying to disable the shift key from allowing users to access
the design view. I've done a search in groups and know i need to
somehow do AllowBypassKey.
Everywhere i look there is code...
|
by: Pietro |
last post by:
Hi all,
First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm...
|
by: OlaPihl |
last post by:
Hi,
How can I by code enable and disable "Bypass proxy server for local
adresses" in Internet Explorer / Tools / Internet Options /
Connections / LAN Settings.
I have made a program (VB.Net)...
|
by: jamesnkk |
last post by:
Hi, I need an advise from the experts here -
I have configure the Tools - Startup option to run the application.
But if User hold down the SHIFT key it can bypass the startup options
to access...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |