AllowBypassKey

J

Joan Wild

Ctrl-G
Tools, References
and put a check beside Microsoft DAO 3.6 Object Library

If you don't use ADO, you can remove the check beside
Microsoft ActiveX Data Objects 2.5 Library
 
G

Guest

Thanks - that got me through the the first part. I entered
DisableShiftKeyBypass() in the immediate window and when I hit enter it gave
me Compile Error: Expected: =
Thoughts? Thanks again!
 
D

Douglas J. Steele

Either leave out the parenthesis, or put Call in front of the function name,
or put a question mark in front:

DisableShiftKeyBypass

or

Call DisableShiftKeyBypass()

or

?DisableShiftKeyBypass()

BTW, you need to make one slight change to the code Joan posted.

Dim prop As Property

needs to be

Dim prop As DAO.Property
 
G

Guest

Joan, Do you have this code in ADO?
--
Lois


Joan Wild said:
Copy your database.

Make sure you are in the main database window. Click the "modules" tab, then
select "new." Alternatively, you can open an existing module if you have
one.

Copy/paste the following function into it. Save the module giving it some
name other than DisableShiftKeyBypass.

**start**

Function DisableShiftKeyBypass() As Boolean
On Error GoTo errDisableShift

Dim db As Database
Dim prop As Property

Set db = CurrentDb()

On Error Resume Next
db.Properties.Delete "AllowByPassKey"
On Error GoTo errDisableShift

Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, False, True)
db.Properties.Append prop
DisableShiftKeyBypass = True

exitDisableShift:
Set prop = Nothing
Set db = Nothing
Exit Function

errDisableShift:
MsgBox "Function DisableShiftKeyBypass did not complete successfully."
DisableShiftKeyBypass = False
Resume exitDisableShift

End Function

***end***

Click on Debug, Compile, and then close the module saving it.

At the database window, hit Ctrl-G which will open the debug window.

Type DisableShiftKeyBypass() and hit enter.

The next time you open the db, the shift will be disabled.

You only need to run the sub once to set the property and then it is set.
It isn't something you would run repeatedly as it isn't necessary.

You can go back to that copy you made in step 1 (which you'll keep in a safe
place) when you want to make changes, or you can use another database to
set the prop back on this database.

Or you could use Albert's utility to set it on/off. Look for By Pass Shift
Key Code at
http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html

--
Joan Wild
Microsoft Access MVP


users open the database by pressing shift key, I have tryed different codes
but i dont know where to put that code and where is the immidiate window, so
pls tell me step by step how to do this. thanks
 
J

Joan Wild

If you set a reference to Microsoft DAO 3.6 and change the code to
Dim prop as DAO.property
I don't think you'll have a problem.
 

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