E
eric
I need to disable the ShiftBypassKey for a database. I
have the sample code from the Microsoft Access Security
FAQ, but have little knowledge of Visual Basic. If
someone could please help me by modifying the follownig
string so that I can simply copy & paste, I would greatly
appreciate it. Thanks in advance.
I have created a new administrator user. "Admin" is
simply a user with no advanced security rights.
MS Access 97
Database Name: Profiler.mdb
Database Location: c:\data\databases\
Workgroup: Unsure where to find this
Here is the code from the FAQs:
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
have the sample code from the Microsoft Access Security
FAQ, but have little knowledge of Visual Basic. If
someone could please help me by modifying the follownig
string so that I can simply copy & paste, I would greatly
appreciate it. Thanks in advance.
I have created a new administrator user. "Admin" is
simply a user with no advanced security rights.
MS Access 97
Database Name: Profiler.mdb
Database Location: c:\data\databases\
Workgroup: Unsure where to find this
Here is the code from the FAQs:
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