Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shift bypass 1

Status
Not open for further replies.

ApplePirate

Programmer
Dec 16, 2002
65
GB
I know this is a regular topic in here.
there is a way to disable the shift key and prevent users from opening the database in design view. But is it possible to assign the bypass to another key other than shift?

 
ApplePirate,

To answer your questions:
1. To disable the shift key, look up the AllowBypassKey property in Access help. You have to set it through VBA code, it can't be done directly through your access interface.

2. I don't know of a way of assigning this to another key, but you could try F10 to open the database window, where you can get to each of the objects, and Ctrl G to open the debug window.

John
 
Yeah,
Ive got the code to disable the shift key, I was just wondering if the bypass function could be assigned to another key one which only the database designer would know of.

 
Yes ApplePirate,

Use This Function :

Sub DSK()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub

Sub ESK()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, True
End Sub

And Then In Any Form Or Function Key Call That To Either Enable Or Disable Like This:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyD Then
Call DSK
End If

If KeyCode = vbKeyE Then
Call ESK
End If

End Sub


I Mean By:
DSK = Disable Shift Key
ESK = Enable Shift Key
D = Disable
E = Enable

Good Luck

" Åä Çááå íÍÈ ÅÐÇ Úãá ÃÍÏßã ÚãáÇ Ãä íÊÞäå "
 
ApplePirate,

If it can be assigned (and I dno't know if it can), it can also be discovered.

Craig
 
I take it you are trying to disable the shift key for users that know about it, but assign it to a different key so you can still access it.
AFAIK there is no way to do this directly, but you could do one of a number of things:
Use the utility on my website to unset the property before you go into the database, then reset it on the way out;
Put some code on a form that opens automatically that checks to see if you have your new key pressed and shows you the database window if you have;
Have a button on your form that takes you to a password screen that if entered correctly will let you view the database window, etc;
or you could write some code that checks your username (either NT or DB login) and then sorts your view out.

If you want help with any of the options, let me know.

hth

Ben

----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
does anyone have any code to check if a key is depressed on start up?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top