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