S
satdist
I have been trying to disable the shift key following a previous post.
I made a new module and pasted the following code, (also I changed the
sequence of the ADO and DAO references) pressed Ctrl-G and pasted
faq_DisableShiftKeyBypass("c:\path to your db\whatever.mdb", True)
corrected the path and hit Enter and I get a Compile Error: Expected:
=. I believe I have followed to the letter and I need help. Thanks for
any help.
Function 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
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."
DisableShiftKeyBypass = False
GoTo exitDisableShift
End If
End Function
I made a new module and pasted the following code, (also I changed the
sequence of the ADO and DAO references) pressed Ctrl-G and pasted
faq_DisableShiftKeyBypass("c:\path to your db\whatever.mdb", True)
corrected the path and hit Enter and I get a Compile Error: Expected:
=. I believe I have followed to the letter and I need help. Thanks for
any help.
Function 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
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."
DisableShiftKeyBypass = False
GoTo exitDisableShift
End If
End Function