How to disable and enable the Bypass Key on your MS Access app so users cannot bypass Autoexec/Forms

Sdílet
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

Komentáře • 46

  • @joeandrews1499
    @joeandrews1499 Před 2 lety +1

    Great job!! Full of good hints for the bypass key control. A must to add security to your code.

  • @kaziehteshamurrashid5098
    @kaziehteshamurrashid5098 Před 2 lety +1

    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.

  • @GrantWhite-vv3yk
    @GrantWhite-vv3yk Před 6 měsíci +1

    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

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před 6 měsíci

      Glad you're enjoying the channel! Try using DAO.Database instead of just Database. Sometimes that can cause an error.

    • @GrantWhite-vv3yk
      @GrantWhite-vv3yk Před 6 měsíci

      @@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.

  • @interestingamerican3100
    @interestingamerican3100 Před 2 lety +1

    Love all your videos! Commenting for the algorithm.

  • @alandrewgibson
    @alandrewgibson Před 2 měsíci +1

    Great work Thank you!

  • @sallychewter9092
    @sallychewter9092 Před 4 měsíci +1

    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.

  • @drcl7429
    @drcl7429 Před 18 dny +1

    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.

  • @franksellers7858
    @franksellers7858 Před rokem +2

    Errors out for me on:
    Set prp = db.CreateProperty(“AllowBypassKey”), dbBoolean, True)
    Message: Run-time error ‘13’: Type mismatch

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před rokem

      Looks like you have one extra ) in there. Try removing the one right after "AllowBypassKey"

    • @tysovanmony
      @tysovanmony Před 5 měsíci

      You might Dim prp as Properties. Please Dim prp as Property.

  • @user-ir5eg2nq5p
    @user-ir5eg2nq5p Před měsícem +1

    Thank you🎉

  • @greenlegacyresortooplabeok8747
    @greenlegacyresortooplabeok8747 Před 7 měsíci +1

    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

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před 7 měsíci

      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.

  • @pavanvshetty9948
    @pavanvshetty9948 Před rokem +1

    I didn't understand about the shortcut file. Can u understand me by going through browse option.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před rokem

      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.

  • @janerovenz
    @janerovenz Před rokem +1

    I was following your tutorial. How to make or where to get the Argument ? Back end?

    • @janerovenz
      @janerovenz Před rokem +1

      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.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před rokem

      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.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před rokem

      Take a look at this video too: czcams.com/video/M6VxBY9mt_s/video.html

  • @simonmaersk
    @simonmaersk Před rokem +1

    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!

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před rokem +1

      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.

    • @simonmaersk
      @simonmaersk Před rokem +1

      @@seanmackenziedataengineering Thank you for the response! I'm glad you think it's a good strategy. A video on this would be awesome!

  • @ouadieibenyahya3368
    @ouadieibenyahya3368 Před rokem +1

    is it possible to apply the procedure to en external database... allowbypass to an external database

  • @Ocram-gnuhc
    @Ocram-gnuhc Před 2 lety +1

    It is interesting. Thanks

  • @gerfer6261
    @gerfer6261 Před rokem +1

    How can I hide modules and vb code in front end please 🤔

  • @valerietopp3161
    @valerietopp3161 Před 2 lety

    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.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před 2 lety

      Interesting.. can you post your procedure? Maybe I can take a look.

    • @valerietopp3161
      @valerietopp3161 Před 2 lety

      @@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

    • @valerietopp3161
      @valerietopp3161 Před 2 lety +1

      I *think* I just figured it out. Had to use DAO.Database and DAO.Property

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Před 2 lety

      @@valerietopp3161 Nice!

  • @mikewashington4188
    @mikewashington4188 Před 2 lety +1

    Wow, the famous 3270 of the 80’s