Results 1 to 5 of 5
  1. #1
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272

    How to disable/enable shift bypass with an administrator password prompt.

    I have a database which am able to disable the shift bypass. But unfortunately, if i need to make any changes to the database, i will have to do the changes and do a whole new installation. i will like to know if there is a way which when i press the shift button, i will be prompted with a password to enable the bypass so changes can be made on the database.
    These are my shift bypass code which i placed in a module:



    Function ap_DisableShift()
    'This function disable the shift at startup. This action causes
    'the Autoexec macro and Startup properties to always be executed.


    On Error GoTo errDisableShift


    Dim db As DAO.Database
    Dim prop as DAO.Property
    Const conPropNotFound = 3270


    Set db = CurrentDb()


    'This next line disables the shift key on startup.
    db.Properties("AllowByPassKey") = False


    'The function is successful.


    Exit Function


    errDisableShift:
    'The first part of this error routine creates the "AllowByPassKey
    'property if it does not exist.
    If Err = conPropNotFound Then
    Set prop = db.CreateProperty("AllowByPassKey", _
    dbBoolean, False)
    db.Properties.Append prop
    Resume Next
    Else
    MsgBox "Function 'ap_DisableShift' did not complete successfully."
    Exit Function
    End If


    End Function


    Function ap_EnableShift()
    'This function enables the SHIFT key at startup. This action causes
    'the Autoexec macro and the Startup properties to be bypassed
    'if the user holds down the SHIFT key when the user opens the database.


    On Error GoTo errEnableShift


    Dim db as DAO.Database
    Dim prop as DAO.Property
    Const conPropNotFound = 3270


    Set db = CurrentDb()


    'This next line of code disables the SHIFT key on startup.
    db.Properties("AllowByPassKey") = True


    'function successful
    Exit Function


    errEnableShift:
    'The first part of this error routine creates the "AllowByPassKey
    'property if it does not exist.
    If Err = conPropNotFound Then
    Set prop = db.CreateProperty("AllowByPassKey", _
    dbBoolean, True)
    db.Properties.Append prop
    Resume Next
    Else
    MsgBox "Function 'ap_DisableShift' did not complete successfully."
    Exit Function
    End If


    End Function




    Afterwards, i put ap_DisableShift in the immediate window to disable shift.

    Will be glad if i could get some help with this since i have tried several options online and is not working for me.

    thank you

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What have you tried? Something like https://bytes.com/topic/access/answe...ord-protection


    Please post code within CODE tags to retain indentation and readability.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    Not sure original post makes sense. If there are multiple users, then what you're re-designing is your non-production fe, right? Only you or other developers have access to it, and you redistribute a copy of it after making modifications. So why would you need to have shift bypass enabled on the db that you hold in reserve as the design master? To me, reads like you release one db for all users to share.

    As for the original request, I'd say it is not possible. To have a prompt would require code to run, which is negated by the bypass - no code or macros will run.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by June7 View Post
    What have you tried? Something like https://bytes.com/topic/access/answe...ord-protection


    Please post code within CODE tags to retain indentation and readability.
    Have tried but it wasn’t working. Maybe I something went wrong or something. Can you break down the whole process in that link for me?

  5. #5
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by June7 View Post
    What have you tried? Something like https://bytes.com/topic/access/answe...ord-protection


    Please post code within CODE tags to retain indentation and readability.
    Finally, it worked. Thanks a lot

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

Similar Threads

  1. Bypass (Shift) key not disabled
    By skydivetom in forum Forms
    Replies: 6
    Last Post: 07-13-2019, 08:16 AM
  2. Enabling shift bypass
    By reynier09 in forum Access
    Replies: 4
    Last Post: 08-18-2016, 08:25 PM
  3. Secuuring the SHIFT bypass function
    By awhittle23 in forum Security
    Replies: 1
    Last Post: 06-22-2016, 06:09 PM
  4. Replies: 3
    Last Post: 06-22-2016, 04:33 PM
  5. Password Form With Enable/Disable Shift Key
    By burrina in forum Code Repository
    Replies: 0
    Last Post: 12-24-2012, 10:53 PM

Tags for this Thread

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