Disable shift key

  • Thread starter Thread starter Sunny
  • Start date Start date
S

Sunny

I want to disable the Shift key so that users cannot bypass the start up
form. How can I do this? I also want them to prevent from direct table
access. Can I do this? how? Thanks.
 
Copy/paste this module. I found it a book years ago. I've
attached to so a fancier form that brings up Open dialog
box so I can use it on many files but all you really need
to do is replace the variables with the database path to
make it work
-Cameron Sutherland

Function DisableShiftKeyBypass(strDBName As String, fAllow
As Boolean) As Boolean
Dim ws As Workspace
Dim db As Database
Dim prop As Property
' From "Frequently Asked Questions About Microsoft®
Access Security
' for Microsoft Access versions 2.0 through 2000"
' Version 2.41 October, 2000
' By Mary Chipman, Andy Baron, Chris Bell, Michael
Kaplan,
' Paul Litwin, and Rudy Torrico
'strDBName = Path and file name of MDB
'fAllow = true to lock, false to unlock
On Error GoTo errDisableShift
Const conPropNotFound = 3270
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(strDBName)
db.Properties("AllowByPassKey") = Not fAllow
DisableShiftKeyBypass = fAllow
If fAllow = False Then
MsgBox "Unlocked"
Else
MsgBox "Locked"
End If
exitDisableShift:
Exit Function
errDisableShift:
'The AllowBypassKey property is a user-defined
'property of the database that must be created
'before it can be set. This error code will execute
'the first time this function is run in a database.
If Err = conPropNotFound Then
'You must set the fourth DDL parameter to True
'to ensure that only administrators
'can modify it later. If it was created wrongly,
then
'delete it and re-create it correctly.
Set prop = db.CreateProperty("AllowByPassKey",
dbBoolean, False, True)
db.Properties.Append prop
Resume
Else
MsgBox "Function DisableShiftKeyBypass did not
complete successfully."
DisableShiftKeyBypass = False
GoTo exitDisableShift
End If
End Function
 
Check Access VB Help on the AllowBypassKey.

Try on a copy of your database and make sure you know how to enable it again
after the BypassKey is disabled. Generally, you should code a back door to
enable it (for your own use).
 
Back
Top