Andy said:
Hi;
Learned from Rob Oldfield that a user can override all my
"PreCautions" by holding down the Shift Key when the open the MDB in
Access.
Using A2K.
Have also learned that "AllowBypassKey" needs to be set to False.
Would someone be so kind to point me in the correct direction.
Andy
The following code procedure comes from the Microsoft Access Security
FAQ document:
'----- start of code -----
Function faq_DisableShiftKeyBypass(strDBName as String, fAllow as
Boolean) As Boolean
On Error GoTo errDisableShift
Dim ws As Workspace
Dim db As DATABASE
Dim prop As Property
Const conPropNotFound = 3270
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(strDBName)
db.Properties("AllowByPassKey") = Not fAllow
faq_DisableShiftKeyBypass = fAllow
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."
Faq_DisableShiftKeyBypass = False
GoTo exitDisableShift
End If
End Function
'----- end of code -----
You should define and call this function, not in the database you want
to secure, but in another "utility" database. When you cal the
function, you pass it the path and name of the database you want to
secure. Bear in mind that, in the absence of user-level security, any
sufficiently knowledgeable user can run similar code to re-enable the
bypass key. But it does put up a greater barrier than relying on the
user's ignorance of the Shift key trick.