Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004
    Posts
    112

    Unanswered: Disable keyboard buttons

    Hi again,
    What a great site ehh!.
    I have wrote an application in Access 2000 and now want to start making it that bit more proffesional and secure. The only problem is that I have given the users a tool that they love- search tool! ALT+F4. With this combination they can click in any field they like press ALT+F4 and hey presto basically search whatever they want. The only downside to this is that the search dialog box also includes the 'find and replace' which could be devastating if you know what I mean. My question is this: Can I disable certain Keyboard keys at runtime?. Also is there a way of disabling the ' Shift' key aswell so that users cannot bypass the startup routine, apart from the Admin user.
    A long one I know but I'm sure with the tallent that is out there someone will have the answer.
    I eagerly await an answer.

    Saltman

  2. #2
    Join Date
    Oct 2003
    Location
    London
    Posts
    341

    Disable bypass

    I can't answer the bit about disabling the keyboard functions but I can answer the one about SHIFT.

    The below is a modification to what someone posted previously on db forums, the advantage to this is that you can call the functions SetBypassPropertyTrue() and SetBypassPropertyFalse() within access at anypoint - mine run from two command buttons on an admin only form.

    Option Explicit

    Public Function SetBypassPropertyTrue()

    Const DB_Boolean As Long = 1
    ChangeProperty "AllowBypassKey", DB_Boolean, True

    End Function

    Public Function SetBypassPropertyFalse()

    Const DB_Boolean As Long = 1
    ChangeProperty "AllowBypassKey", DB_Boolean, False

    End Function

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

    Dim dbs As Object, prp As Variant
    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.
    ChangeProperty = False
    Resume Change_Bye
    End If

    End Function


    Be warned though, if you disable bypass and have no other way to get to your db window you might as well give up trying to get back in.

    The way I got around this is to create an admin form with a password. Only users with this password can access the admin form and thus press the command buttons which will call the two functions: SetBypassPropertyTrue() and SetBypassPropertyFalse()

  3. #3
    Join Date
    Sep 2004
    Posts
    112
    Cheers Christyvxo

    I'll give it a go.

    Saltman

Posting Permissions

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