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

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น • 48

  • @greenlegacyresortooplabeok8747
    @greenlegacyresortooplabeok8747 10 หลายเดือนก่อน +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  10 หลายเดือนก่อน

      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.

  • @janerovenz
    @janerovenz 2 ปีที่แล้ว +1

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

    • @janerovenz
      @janerovenz 2 ปีที่แล้ว +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  2 ปีที่แล้ว

      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  2 ปีที่แล้ว

      Take a look at this video too: th-cam.com/video/M6VxBY9mt_s/w-d-xo.html

  • @ouadieibenyahya3368
    @ouadieibenyahya3368 ปีที่แล้ว +1

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

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  ปีที่แล้ว

      Yes you can, by opening that database from the current instance: th-cam.com/video/hhPrBMLNiDs/w-d-xo.html

  • @pavanvshetty9948
    @pavanvshetty9948 ปีที่แล้ว +1

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

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  ปีที่แล้ว

      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.

  • @simonmaersk
    @simonmaersk ปีที่แล้ว +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  ปีที่แล้ว +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 ปีที่แล้ว +1

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

  • @gerfer6261
    @gerfer6261 ปีที่แล้ว +1

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

  • @franksellers7858
    @franksellers7858 ปีที่แล้ว +2

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

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  ปีที่แล้ว

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

    • @tysovanmony
      @tysovanmony 8 หลายเดือนก่อน

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

  • @sallychewter9092
    @sallychewter9092 8 หลายเดือนก่อน +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.

    • @sallychewter9092
      @sallychewter9092 8 หลายเดือนก่อน +1

      I found the issue. I changed both Dim db and Dim prp to DAO...

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  8 หลายเดือนก่อน

      I see you found the issue! Thanks for sharing the solution.

  • @kaziehteshamurrashid5098
    @kaziehteshamurrashid5098 2 ปีที่แล้ว +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.

  • @joeandrews1499
    @joeandrews1499 2 ปีที่แล้ว +1

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

  • @valerietopp3161
    @valerietopp3161 2 ปีที่แล้ว

    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  2 ปีที่แล้ว

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

    • @valerietopp3161
      @valerietopp3161 2 ปีที่แล้ว

      @@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 2 ปีที่แล้ว +1

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

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  2 ปีที่แล้ว

      @@valerietopp3161 Nice!

  • @drcl7429
    @drcl7429 4 หลายเดือนก่อน +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.

  • @alandrewgibson
    @alandrewgibson 6 หลายเดือนก่อน +1

    Great work Thank you!

  • @interestingamerican3100
    @interestingamerican3100 2 ปีที่แล้ว +1

    Love all your videos! Commenting for the algorithm.

  • @GrantWhite-vv3yk
    @GrantWhite-vv3yk 10 หลายเดือนก่อน +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  10 หลายเดือนก่อน

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

    • @GrantWhite-vv3yk
      @GrantWhite-vv3yk 10 หลายเดือนก่อน

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

  • @3SfourAfendi
    @3SfourAfendi 4 หลายเดือนก่อน +1

    Thank you🎉

  • @Ocram-gnuhc
    @Ocram-gnuhc 2 ปีที่แล้ว +1

    It is interesting. Thanks

  • @mikewashington4188
    @mikewashington4188 2 ปีที่แล้ว +1

    Wow, the famous 3270 of the 80’s

  • @bcowl03
    @bcowl03 2 หลายเดือนก่อน +1

    Say it with me -- Access isn't meant to be a front end!

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  2 หลายเดือนก่อน

      It has use cases where it works well. Great for fast prototypes or workgroup databases, but can be a pain to put into production with proper security etc. At a certain point you start looking for browser-based front-ends. I find that where Access excels in in data cleaning, wrangling, transformation, and joining many disparate data sources for analysis. For those in the know, it is much faster than using Python or other methods with desktop data. Here is a quick web front-end: th-cam.com/video/TbAECDT7FFU/w-d-xo.html