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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disable Shift key??

Status
Not open for further replies.

Fekri

Programmer
Jan 3, 2004
284
IR


Hi,

I have seen the faq181-143 but I don't know how to use it.
where I have to put this code to disable shift key???

THanks to every people
Ali
 
Place the code for both Subs in a module. You can then invoke them from anywhere in your application (inside a button click event for example.)

Check this link for the documentation on the AllowByPassKey property


It doesn't really turn off the Shift key everywhere in the program ... it just stops the user from holding down the shift key on startup which normally would bypass execution of the startup properties and the Autoexec macro.
 
Thanks, but I put this code in many place on my project such as onclick of one botton on my main form or in onopen of main form but still shift ket is not disabled


Thanks
Ali
 
The db has to be closed and re-opened for it to work.
You don't have to put it all over the place in your db.

Make sure you've made a copy of your db before doing any of this.

TO DISABLE THE SHIFT KEY: Put the disable code from the FAQ into a code module and save it.

I have a DEV copy of my database which I never disable the shift key in. Once I'm ready to release to production, I make a copy of the DEV db, open it, open the code module, run the DISABLE SHIFT KEY code, close the db, delete the previous production db, and rename this new db for production. The next time I or anyone opens this db, the shift key will be disabled.

In order to save myself should I totally honk something up (which I have certainly done), I also have the ENABLE BYPASS KEY code to save my a**. I put a text box on the main form which opens when the db is launched. I make it's background transparent. In it's OnClick event, I put the ENABLE BYPASS KEY code. Only I know it's there. So if my DEV copy gets destroyed some how, I can always make a copy of the Production db, and enable the bypass key. Again: I open my savior prod db, click in the transparent text box. It has a pop-up message "Done!" as the last statement. Close, then re-open using the shift key, and you have a DEV version again.


Hope this helps--g


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,

Thanks for your explain

I will so as you are doing for your projects
but for the onclick event of textbox, when I put directly the code which is in FAQ it can not run because it's function.

whould I change some lines of this code???

Thanks
Ali
 
You don't paste the whole thing, just the lines in between FUNCTION....END FUNCTION.

For example, if you text box is named BypassKey, the code will look like this:

Code:
Private Sub ByPassKey_Click()
Dim DB As Database
Set DB = CurrentDb
DB.Properties.Delete "AllowByPassKey"
DB.Properties.Refresh
MsgBox "DONE"

End Sub


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
hi,

I tried this code
but i recieve the error which says : Item not found
on this line:
DB.Properties.Delete "AllowByPassKey"

I don't know why it can run on my another database

do you know if maybe sometgings required??

Ali
 
Did you already run the code that DISABLES the bypass key? You can't 'delete' the property unless you've created it first with this code (from the original post):

'********************************************************
'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
'********************************************************


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top