Bypass Shift Key Problems...Help Please

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
 
J

Joan Wild

paste
?faq_DisableShiftKeyBypass("c:\path to db\db.mdb", true)

That should return true in the immediate window.
 
S

satdist

I pasted as you suggested and I get a Compile error: sub or Function
not defined. Any ideas?
 
J

Joan Wild

What is the name of the function? Have you ensured that you didn't name the
module the same thing as the function (they need different names)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top