fuerteventura
asked on
Disable F11 Key
My Front end application in Access requires the fullest possible security. To this extent I am disabling the special keys so users cannot do the hold down SHIFT bypass, nor can they access the database window via the F11 key once the database is open.
Obviously I want to be able to access the code and database objects. What I need to do is have a button which enables the special keys and therefore enables the F11 key to access the database window. I can use an if statement and read the MDW file to test if it is my logon.
I am using the following Module
:
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(strProp Name, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Resume Change_Bye
End If
End Function
Public Function BypassKey(onoff As Boolean)
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, onoff
End Function
And I am calling the code via the code in a button which is:
Btpass(true)
However, when I click on the button to call the code above, hitting F11 after does nothing. Is it possible to achieve the above?
Obviously I want to be able to access the code and database objects. What I need to do is have a button which enables the special keys and therefore enables the F11 key to access the database window. I can use an if statement and read the MDW file to test if it is my logon.
I am using the following Module
:
Public Function ChangeProperty(strPropName
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strProp
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Resume Change_Bye
End If
End Function
Public Function BypassKey(onoff As Boolean)
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, onoff
End Function
And I am calling the code via the code in a button which is:
Btpass(true)
However, when I click on the button to call the code above, hitting F11 after does nothing. Is it possible to achieve the above?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.