Results 1 to 2 of 2
  1. #1
    awhittle23 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2016

    Secuuring the SHIFT bypass function


    I have some code which should stop the shift key from bypassing the startup unless i have a password from a hidden function as per instructions below.
    But im having issues getting it to work.. Does any one know of a way this can be done or see whats wrong with the instructions/code i have at the moment.
    I have tried to follow these instructions but i get problems..

    When i do the references it comes up with a missing *.dll

    How To Disable/Enable the Shift Bypass Key in Microsoft Access:

    QUESTION Is there any way of preventing user's from holding down Shift Key when opening up my Microsoft Access database and bypassing the Start-Up options which have been disabled.
    I however, still need some sort of facility to do this, so I can add new forms, queries etc. whenever necessary.
    SOLUTION To prevent a user bypassing the start-up options you will need to apply the following function and code to a command button (or ideally a hidden option, such as to the double-click event of a label or graphic).
    This will prevent anyone without the password bypassing the start-up by using the Shift key.
    The below function and command button code will allow you to use a password protected input box to determine if the Shift key can be disabled or not.
    You might have to set your "References" in the VBA editor to DAO 3.6.
    When you are viewing a Module, click the Tools menu References. Browse for Microsoft DAO 3.6
    Select "Files of type: Executable Files (*.exe; *.dll)"
    C:\Program Files\Common Files\Microsoft Shared\DAO)
    Then explicitly dimension your code, i.e. Dim db As DAO.Database, prp As DAO.Property
    '***************** Code Start ***************
    'Copy this function into a new public module.

    Option Compare Database
    Option Explicit

    Public Function SetProperties(strPropName As String, _
    varPropType As Variant, varPropValue As Variant) As Integer

    On Error GoTo Err_SetProperties

    Dim db As DAO.Database, prp As DAO.Property

    Set db = CurrentDb
    db.Properties(strPropName) = varPropValue
    SetProperties = True
    Set db = Nothing

    Exit Function

    If Err = 3270 Then 'Property not found
    Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
    db.Properties.Append prp
    Resume Next
    SetProperties = False
    MsgBox "SetProperties", Err.Number, Err.Description
    Resume Exit_SetProperties
    End If
    End Function
    '***************** Code End ***************Once you have created the module, then you will need to attach the following code to a command button (or label, graphic etc.):
    '***************** Code Start ***************
    'Assign this to the OnClick event of a command button (or double-click event
    'of a label or graphic) named "bDisableBypassKey"
    'Change the "TypeYourBypassPasswordHere" default password to your password

    Private Sub bDisableBypassKey_Click()
    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
    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 = "TypeYourBypassPasswordHere" Then
    SetProperties "AllowBypassKey", dbBoolean, True
    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"
    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 Sub
    MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
    Resume Exit_bDisableBypassKey_Click
    End Sub
    '***************** Code End ***************Once this is in place, a user will not have access to bypass the Start-Up options.
    As the administrator, you can then click on your command button, label or graphic and will be presented with the following input box:

    If the correct password is entered you will see the following message:

    An incorrect password will give the following message and not allow the Shift key to bypass the Start-Up options:

    Note: Always create a backup copy of the database, to test out any areas that may cause problems when working with start-up options or disabling Access features.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    When i do the references it comes up with a missing *.dll
    May or may not be relevant but looks like this refers to really old version of Access. Try scrolling down the references for Microsoft DAO 3.6 Object library

    Also suggest you use the code tags to preserve code formatting (the indents). Your code is difficult to read as presented and personally I'm not going to spend time trying to decipher it if that is where your issue is

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 06-22-2016, 04:33 PM
  2. Replies: 2
    Last Post: 08-19-2013, 01:14 PM
  3. bypass parameter
    By Epona in forum Queries
    Replies: 1
    Last Post: 06-09-2012, 05:57 PM
  4. Bypass beforeclose event
    By dsk96m in forum Programming
    Replies: 21
    Last Post: 12-21-2011, 12:12 PM
  5. Bypass startup to allow design
    By cjbuechler in forum Access
    Replies: 1
    Last Post: 06-25-2010, 03:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums