How to disable and enable the Bypass Key on your MS Access app so users cannot bypass Autoexec/Forms
Vložit
- čas přidán 7. 09. 2024
- Access applications can have lots of great startup options like a startup form or Autoexec macros that do things as soon as the application is started. However, these options can easily be defeated by holding down the shift key as the file is opened, exposing all of the design to the user. In many cases, this is really not preferable, since it is better to keep these things hidden from the user. In this episode, we'll look at how to disable the AllowBypassKey property on the database, so that users cannot bypass startup forms and macros. We will also look at one useful strategy for "unlocking" the file so that you can continue to work on it before deploying it to users again.
Related Videos:
How to disable and enable the Bypass Key on your MS Access app so users cannot bypass Autoexec/Forms
You are watching this video now!
Link and Relink Your Access Front-End App Using vbScript and a Table-Based Approach
• Link and Relink Your A...
How to Use vbScript to Relink Your User's MS Access Application Front-End Automatically
• How to Use vbScript to...
Use vbScript to Deploy your Access Front End, Create Shortcuts, and Check for Updates on User Login
• Use vbScript to Deploy...
How to Encrypt and Hash Passwords in MS Access
• How to Encrypt and Has...
How to Encrypt Sensitive Data in Microsoft Access
• How to Encrypt Sensiti...
How to Kick Users out of Your MS Access Database
• How to Kick Users out ...
How to Get the IP Address in Microsoft Access
• How to Get the IP Addr...
How to Get the Windows Username in MS Access
• How to Get the Windows...
How to Set Basic Startup Options on Your Microsoft Access Database
• How to Set Basic Start...
Interested in transforming your career or finding your next gig?
system.billzon...
Want my team to do a project for you? Let's get to it!
system.billzon...
Want to get access to premium content made just for you and have a chat with me? Find me on Patreon :
/ mackenziedataengineering
Demo of my BZ RDP Cloaker:
www.patreon.co...
Want to work with me 1:1? Contact me today and book your free 20 min consultation!
Contact form you can find at www.mackenziema...
Follow me on social media:
/ mackenziedataanalytics
/ seamacke
/ seamacke
/ seamacke
/ psmackenzie
Get Microsoft Office including Access:
click.linksyne...
Got a CZcams Channel? I use TubeBuddy, it is awesome. Give it a try:
www.tubebuddy....
#msaccess #access #vba
Great job!! Full of good hints for the bypass key control. A must to add security to your code.
Thanks!
Thank you for your effort. I always following your all release. I am waiting for the topics on TAG and Tree Menu. Thank you once again.
Great idea for a video! I have a good technique for the treeview control.
Hi Sean: Thank you so much for this video!! It is exactly what I am looking for. Not sure if you are still answering questions about this, but I am having an issue when compiling the LockDB code as below and I can't quite figure out what I am doing wrong. (I am quite new to VBA programming.) The error is: "User-defined type not defined." The error is occurring the Dim db As database as below:
Sub LockDb()
On Error GoTo Sub_Error
Dim db As database
Glad you're enjoying the channel! Try using DAO.Database instead of just Database. Sometimes that can cause an error.
@@seanmackenziedataengineering Hi Sean. Thanks for the quick reply!! That didn't work, but I think the issue may be that I am creating the Module in an existing database I created a while back as I created the module in a brand-new database with just a single table and it complied fine, so the issue is probably somewhere in my database.
Love all your videos! Commenting for the algorithm.
You're the best!
Great work Thank you!
Glad you liked it!
Thanks for all your tutorials, they are very helpful, but I'm also getting run-time error '13' Type mismatch.
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, True) and Dim prp as Property.
I found the issue. I changed both Dim db and Dim prp to DAO...
I see you found the issue! Thanks for sharing the solution.
When is sub lockDb run?
Nevermind, wasn't watching closely enough, I see it is just manually run. Not something I have ever done.
I think I will do it using a button.
Got it - nice idea to use a button!
Errors out for me on:
Set prp = db.CreateProperty(“AllowBypassKey”), dbBoolean, True)
Message: Run-time error ‘13’: Type mismatch
Looks like you have one extra ) in there. Try removing the one right after "AllowBypassKey"
You might Dim prp as Properties. Please Dim prp as Property.
Thank you🎉
Welcome!
This procedure worked for one database but doesn't work for others. Can you advise why?
Sub LockDb()
On Error GoTo MyErr
Dim Db As Database
Dim Prp As Property
Set Db = CurrentDb
Db.Properties("AllowBypassKey") = False
Exit Sub
MyErr:
If Err.Number = 3270 Then
Set Prp = Db.CreateProperty("AllowBypassKey", dbBoolean, True)
Db.Properties.Append Prp
Db.Properties("AllowBypassKey") = False
Exit Sub
End If
End Sub
Try putting
*Else
MsgBox Err & ", " & Error*
just before your last End If
You may get an error on the other computers that you don't see now.
I didn't understand about the shortcut file. Can u understand me by going through browse option.
Shortcut files usually just point to a particular file or program. However, they also have the capability to have "switches" or arguments, so that a program or file will open a certain way. In this case, receiving the command to unlock itself when it opens.
I was following your tutorial. How to make or where to get the Argument ? Back end?
Where can i see the access front-end file?
I have this simple access file that i need to protect the table and forms that i have built.
The argument is usually something you'll store as an admin. Maybe in a shortcut file or a text file, so you can use it to enable the bypass key again.
Take a look at this video too: czcams.com/video/M6VxBY9mt_s/video.html
It seems like my comment got deleted for some reason... I just have a quick question, because I found the Command technique very interesting. I have a VBS file that launches an Access database with the Shell Run function. Is it possible to pass a command into that kinda like the way you do it in this video? I want to avoid the user opening the Access file without going through the VBS. Thank you!
Actually, this is a very good strategy! Using Command, you can pass any kind of instruction to your application on how it should open, what features should be exposed, etc. Good topic for a video.
@@seanmackenziedataengineering Thank you for the response! I'm glad you think it's a good strategy. A video on this would be awesome!
is it possible to apply the procedure to en external database... allowbypass to an external database
Yes you can, by opening that database from the current instance: czcams.com/video/hhPrBMLNiDs/video.html
It is interesting. Thanks
Glad you enjoyed it
How can I hide modules and vb code in front end please 🤔
The best way is to convert it to a .accde. Great idea for a video!! Thx
I copied the code exactly as you have it. But it keeps failing on the db.Properties("AllowBypassKey") line. I print the error message in the immediate window, and I get 3270, but it's not falling through to the error code. I'm perplexed as I am a pretty experienced programmer in MSAccess.
Interesting.. can you post your procedure? Maybe I can take a look.
@@seanmackenziedataengineering
Sub LockDB()
On Error GoTo Sub_Error
Dim db As Database
Dim prp As Property
Set db = CurrentDb
db.Properties("AllowBypassKey") = False
MsgBox "Lock Confirmed.", vbInformation, "Bypass"
Exit Sub
Sub_Error:
Select Case Err
Case 3270
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, True)
db.Properties.Append prp
db.Properties("AllowBypassKey") = False
MsgBox "The bypass property was not found, so it was created.", vbInformation, "Bypass"
Case Else
MsgBox "There was an error. (" & Err & ") " & Error
End Select
End Sub
I *think* I just figured it out. Had to use DAO.Database and DAO.Property
@@valerietopp3161 Nice!
Wow, the famous 3270 of the 80’s
lol yeah! wasn't that a terminal?
@@seanmackenziedataengineering Yes, it was back-n-da-day