Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2003
    Location
    Leeds, West Yorkshire, UK
    Posts
    12

    Question Unanswered: Disable Bypass Key

    I'm trying to find a way of disabling the bypass at startup if a user keeps the shift key pressed when opening the database.

    Any suggestions?

    Cheers,

    Pete

  2. #2
    Join Date
    Sep 2003
    Location
    Lancashire, UK
    Posts
    22
    This can only be set using VBA.

    Code:
    Set dbs = CurrentDb
    dbs.Properties("AllowBypassKey") = [True|False]
    Will enable/disable the bypass key.

    This will fail though the first time you try to set this property for a db.
    The property has to be added to the properties collection first, but once it has been added it doesn't need to be added anymore.
    To initially add the property do the following

    Code:
    Set dbs = CurrentDb
    Set prp = dbs.CreateProperty("AllowBypassKey", dbBoolean, [True|False])
    dbs.Properties.Append prp
    Select either True or False for the final argument of CreateProperty to set the initial value of the property

    So that you don't "lock" yourself out of your won db, make sure that you create a method of running the code to toggle between allowing/disallowing the shift key, which can only be run by youself, eg by accessing a password controled form.

  3. #3
    Join Date
    Jul 2003
    Location
    Harrow, UK
    Posts
    53
    Originally posted by Robbo

    So that you don't "lock" yourself out of your won db, make sure that you create a method of running the code to toggle between allowing/disallowing the shift key, which can only be run by youself, eg by accessing a password controled form.
    Just supposing for arguments sake (and not looking back at my post of last weekend) one had been silly enough to lock oneself out by setting SetByPass=No, is there any way around this? I just casually wondered .... not for any partilular reason you understand......
    Thank you,
    James

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    jamesmc2,

    Just in case you need this... you never know, you might accidentally lock yourself out someday... This is right out of Access Help:

    "Even if you set both the StartupShowDBWindow and AllowSpecialKeys properties to False, it's possible that a user can still access the Database window. This can happen if a user tries more than once to open the same database from the list of most-recently-used databases, which automatically appears on the File menu. To prevent users from accessing this list, replace the File menu with your own custom menu."

    Also, I've never done this myself, so I'm guessing here...
    It may be possible to change the properties of one database from within
    another database

    Set dbs = DbEngine.Workspaces(0).OpenDatabase("C:\OtherDB.md b")
    dbs.properties("AllowBypassKey")=True

    It may be worth a shot!

    Mark
    Inspiration Through Fermentation

  5. #5
    Join Date
    Sep 2003
    Location
    Leeds, West Yorkshire, UK
    Posts
    12

    Talking

    Much appreciated all.....

    I can now sleep a little easier.....lol

    Pete

  6. #6
    Join Date
    Sep 2003
    Location
    Lancashire, UK
    Posts
    22
    "Even if you set both the StartupShowDBWindow and AllowSpecialKeys properties to False, it's possible that a user can still access the Database window. This can happen if a user tries more than once to open the same database from the list of most-recently-used databases, which automatically appears on the File menu. To prevent users from accessing this list, replace the File menu with your own custom menu."
    This will not work though if you set the 'Allow Full Menus' property to false. So be careful of this.


    Also, I've never done this myself, so I'm guessing here...
    ...
    Set dbs = DbEngine.Workspaces(0).OpenDatabase("C:\OtherDB.md b")
    dbs.properties("AllowBypassKey")=True
    This will work.

    If you are going to "lock" a few db's it may be worth creating an admin db which you can use to "unlock" whichever db you select.
    Though it is a good idea to keep an "unlocked" copy of a database which you use for development

  7. #7
    Join Date
    Jul 2003
    Location
    Harrow, UK
    Posts
    53

    Set dbs = DbEngine.Workspaces(0).OpenDatabase("C:\OtherDB.md b")
    dbs.properties("AllowBypassKey")=True
    Where would one put this? I;m guessing in the OnOpen of the first form.
    Thank you,
    James

  8. #8
    Join Date
    Sep 2003
    Location
    Lancashire, UK
    Posts
    22
    quote:
    --------------------------------------------------------------------------------

    Set dbs = DbEngine.Workspaces(0).OpenDatabase("C:\OtherDB.md b")
    dbs.properties("AllowBypassKey")=True

    --------------------------------------------------------------------------------



    Where would one put this? I;m guessing in the OnOpen of the first form.
    This can be put anywhere you like in any database other than the one that you might someday lock yourself out of.
    If you wanted to create an admin db you could create a form with a combo box and a button. The combo box would list all db's, incluing the full path, that you have created which have their ByPass key disabled. The button's on click would be code something like


    Code:
    Private Sub CommandButtonName_Click
    
        dim dbs as Database
    
        Set dbs = DbEngine.Workspaces(0).OpenDatabase(ComboBoxName)
        dbs.properties("AllowBypassKey")=True
        set dbs = nothing
    
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •