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 key

Status
Not open for further replies.

ROMBA

MIS
Feb 14, 2002
43
BE
Hello,

I am trying to run the disable shift key. see code below. But I always have the error message:

'compile error : user-defined type not defined'

can you please help me with this one?
I tried to set the name of the database as a criteria, but this doesnt work.

Thank you !!

This is from the FAQ of the Access General Discussion:

How can I disable the shift key at startup?
FAQ181-143

How Do I Disable the Shift Key During Startup?

Read All Carefully Before Proceeding!!!!!!!!!

Here is two sub routines. One is to disable the shift key and the other is to re-enable the shift key.
You only need to call the disable code one time and the shift key will remain disabled until you run the Re-enable code.

The main thing to remember is that you need a way to run the Re-enable code from your open app, but you don't want the user to know how to do it. If you don't have a way to re-enable the shift key will have locked yourself out as well. I usually place a small transparent button on a screen that is seldom used by the user. I usually place the button in a corner where I know where it's at. The Re-enable code is called by the On Click event of this transparent button.

To run the disable the shift key code, you do something similar to the above approach or call the sub how ever you wish. The thing to remember is "Have a way to Re-enable the shift key".

Special Note...............
Make a backup of you db before you start.

'********************************************************
'This Code Disables the Shift Key
'
Public Sub DisableByPassKeyProperty()
Dim db As Database
Dim prp As Property
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.Append prp
End Sub
'********************************************************


'********************************************************
'This Code Re-enables the Shift Key
'
Public Sub EnableByPassKeyProperty()
Dim db As Database
Set db = CurrentDb
db.Properties.Delete "AllowByPassKey"
db.Properties.Refresh
End Sub
'********************************************************

HTH
RDH

 
Have you referenced Microsoft DAO in your vba window? JHall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top