Results 1 to 9 of 9
  1. #1
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234

    Coding a module and command button to disable shift override.

    Can someone more versed in Access '07 please read this: http://www.databasedev.co.uk/disable_shift_bypass.html and essentially hold my hand through the process? I tried, and I couldn't get past copying and pasting the first bit of code into a new module.



    Thank you!

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Before continuing -follow the advice in your link

    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
    .

    create a button called bDisableBypassKey on a form then copy the 2nd bit of code into that button's click event.

    save the form then open it, stand back and click the button

    when prompted for a password, per the code type 'TypeYourBypassPasswordHere'

  3. #3
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106
    I'm having trouble imagining why one would want a button in an application to disable the Shift key ... if one has one's mouse/finger poised over such a button, one must have already opened the app ... i.e. one has already had an opportunity to hold down Shift to open the app with it's workings laid bare ... so the horse has bolted.

    Shouldn't one always publish a serious app as a .mde ... wouldn't it be best to do that and code the Main Switchboard's OnOpen event to disable the Shift key if the app being opened is a .mde? That is, not if the source .mdb is being opened.

    If that's how you want to do it, yell out and I'll upload suitable code.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by knarfreppep View Post
    I'm having trouble imagining why ...
    Creating an executable will get rid of the VBA. The biggest hurdle is keeping the Users from Options and Objects. Bypassing the Shift Key is one, good, step towards protecting your app.

  5. #5
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106
    I'll upload code for the Main Switchboard (i.e. default form) just in case.

    Note that you must open the .mde at least once before publishing it to your users so this code runs before they get a chance to open it with Shift down.

    Private Sub Form_Load()

    If CodeDb.Properties("MDE") = "T" Then
    mfctByPassKey_Disable
    End If

    End Sub


    Private Function mfctByPassKey_Disable()

    On Error GoTo Error_mfctByPassKey_Disable

    CodeDb.Properties("AllowByPassKey") = False

    Exit_mfctByPassKey_Disable:
    Exit Function

    Error_mfctByPassKey_Disable:
    Select Case Err
    Case 3270
    CodeDb.Properties.Append CodeDb.CreateProperty("AllowByPassKey", dbBoolean, False)
    Resume Next
    Case Else
    MsgBox Err.Number & " " & Err.Description
    End Select
    Resume Exit_mfctByPassKey_Disable

    End Function

  6. #6
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106
    Quote Originally Posted by ItsMe View Post
    Bypassing the Shift Key is one, good, step towards protecting your app.
    I fully agree. But surely not AFTER the app is open?

  7. #7
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106
    I don't want to be an Advanced Beginner.

    Does anyone know if/how I can become a Novice again please?

  8. #8
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Quote Originally Posted by knarfreppep View Post
    I'll upload code for the Main Switchboard (i.e. default form) just in case.
    As I am a complete and total novice, I find that although I have no problem opening up a module in which to paste this code, I don't know whether to do it on the back end or front end, nor do I know how to make it work once it's saved as something.

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862

    Example Database File

    Here is a working example of what I use. It is not what was in the link. But it is a more simple approach, if you ask me. A form will launch at start up. You can use the shift key to bypass the form launching.

    Click the appropriate button to disable or enable the ability to bypass the shift key. There is code behind each of the buttons. The code calls a function. The functions are in a module named modLockMe. Copy the module into the DB that you want to lock.

    On a side note, what I do is distribute copies of the FE file to the users. Before I provide a copy of my master copy, I call the function (in the copy) to disable the shift key from the Immediate Window. Then, the copy can be thrown away after use.
    Attached Files Attached Files

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

Similar Threads

  1. disable shift key
    By AzizSader in forum Forms
    Replies: 3
    Last Post: 09-20-2014, 09:02 AM
  2. Replies: 5
    Last Post: 03-13-2012, 12:28 PM
  3. Disable command button
    By rajulasb in forum Access
    Replies: 2
    Last Post: 08-04-2011, 05:32 AM
  4. Continuous Form Disable Command Button
    By mbake085 in forum Programming
    Replies: 4
    Last Post: 05-27-2011, 08:55 AM
  5. how to disable command button
    By archie in forum Access
    Replies: 1
    Last Post: 08-27-2009, 11:11 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