Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2004
    Posts
    15

    Unanswered: How do I disable Shift key while log on.

    Hello.

    I'm trying to create a secure db. I set up some admin and user accounts. It all works fine until user account holds down Shift key while logging on. Even though the account is limited there're still plenty of unwanted functionality.

    Does anybody know how to disable the Shift key while log on?

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: How do I disable Shift key while log on.

    Originally posted by dbforumer
    Hello.

    I'm trying to create a secure db. I set up some admin and user accounts. It all works fine until user account holds down Shift key while logging on. Even though the account is limited there're still plenty of unwanted functionality.

    Does anybody know how to disable the Shift key while log on?

    Look up AllowBypassKey

  3. #3
    Join Date
    Feb 2004
    Posts
    15
    Yeah, I looked up the 'AllowBypassKey'. Where do I use it? Do I set up a 'Start Up' form and in it's Form_Load procedure use it? or what? I guess that won't work 'cause the bypass was already done...

    I'm not sure how to catch db loading so I can set 'AllowBypassKey' and stop Shift key bypass.

    Any idea anybody?

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by dbforumer
    Yeah, I looked up the 'AllowBypassKey'. Where do I use it? Do I set up a 'Start Up' form and in it's Form_Load procedure use it? or what? I guess that won't work 'cause the bypass was already done...

    I'm not sure how to catch db loading so I can set 'AllowBypassKey' and stop Shift key bypass.

    Any idea anybody?
    Use the AllowBypassKey in the On_Open of your main form, make a function to enable or disable it, as in the example and call the function to disable it at the start. Close your DB, next time yu start it, the SHIFT Key will be disabled

  5. #5
    Join Date
    Nov 2003
    Location
    Sussex, England
    Posts
    404
    You may have to run the AllowByPassKey function once before it works.

    I put it into a function which I then call from the Autexec macro. It seems to work OK this way, although I've bundled it with a load of other startup options.

    By the way it's far from cast iron as a means of securing your database - if that's what you're trying to do. An easy way round it is to copy your database into a blank database.

    Good luck.


  6. #6
    Join Date
    May 2004
    Posts
    159

    I use this to disable shift enter

    Here is what I am using to secure the database

    Public Function CheckWorkgroup()
    On Error GoTo Err_CheckWorkgroup

    'called from autoexec macro .runcode

    Dim strSystemDB As String
    Dim intViewDbWind As Integer
    Dim strusername

    strusername = Environ("UserName")

    Select Case strusername
    ' enter those with administrative access to the database here -
    Case "Administrator", "user1", "user2"
    intViewDbWind = _
    MsgBox("View Database Window next time Db is opened?", vbYesNo)


    Select Case intViewDbWind

    Case 6 ' vbYes = 6

    ChangeProperty "StartupForm", dbText, "switchboard"
    ChangeProperty "StartupShowDBWindow", dbBoolean, True
    ChangeProperty "StartupShowStatusBar", dbBoolean, True
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True

    Case 7 ' vbNo = 7

    ChangeProperty "StartupForm", dbText, "switchboard"
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    ChangeProperty "StartupShowStatusBar", dbBoolean, False
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    ChangeProperty "AllowFullMenus", dbBoolean, False
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    ChangeProperty "AllowSpecialKeys", dbBoolean, False
    ChangeProperty "AllowBypassKey", dbBoolean, False

    Case Else

    MsgBox "It is unclear if the Database window will show" & _
    "or not the next time the database is opened", vbOKOnly

    End Select


    Case Else

    ChangeProperty "StartupForm", dbText, "switchboard"
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    ChangeProperty "StartupShowStatusBar", dbBoolean, False
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    ChangeProperty "AllowFullMenus", dbBoolean, False
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    ChangeProperty "AllowSpecialKeys", dbBoolean, False
    ChangeProperty "AllowBypassKey", dbBoolean, False

    End Select

    Exit_CheckWorkgroup:

    Exit Function

    Err_CheckWorkgroup:

    MsgBox "Error: " & Err.Number & " " & Err.Description, vbOKOnly, "CheckWorkgroup"
    Resume Exit_CheckWorkgroup

    End Function

    Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer

    'used for changing database startup properties

    Dim dbs As Database, prp As Property
    Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True

    Change_Bye:
    Exit Function

    Change_Err:
    If Err = conPropNotFoundError Then ' Property not found.
    Set prp = dbs.CreateProperty(strPropName, _
    varPropType, varPropValue)
    dbs.Properties.Append prp
    Resume Next

    Else
    ' Unknown error.
    MsgBox Err.Description, vbOKOnly
    ChangeProperty = False
    Resume Change_Bye

    End If

    End Function
    Last edited by WilliamS; 08-31-04 at 14:57.

  7. #7
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    why dont you just Lower caps the userName after they're done typing it?

  8. #8
    Join Date
    May 2004
    Posts
    159
    Quote Originally Posted by Jerrie
    why dont you just Lower caps the userName after they're done typing it?
    What would that accomplish? I didn't write the code originally but I have modified it to fit my needs.

  9. #9
    Join Date
    Nov 2003
    Location
    Sussex, England
    Posts
    404

    AllowByPassKey

    I have no criticisms of the solutions offered so far, and have use almost the same methods. One thing I have become a bit fed up with is the users log on box (our network people don't always update the .mdw files as we would like.)

    Now, more often than not I write a bit of code to expose the window. Something like:

    If Me.txtPWD = "myPassword" Then
    'Show the database window
    DoCmd.SelectObject acTable, , True
    DoCmd.Close acForm, "frmShowWindow"
    Else
    DoCmd.Close
    End If

    It makes life a bit easier. (I capture the user name from the PC for audit purposes.)


    And of course no-one can get past the AllowByPass key code, wich I call from the AUTOEXEC macro.

    That's just an idea if you need to get into the database after disabling the shift key, and don't want the hassle of .mdw files.

    Last edited by Ryker; 09-01-04 at 09:54. Reason: Spelling!

Posting Permissions

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