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

disabling the shift key 1

Status
Not open for further replies.

solo7

Technical User
Mar 14, 2001
243
NO
I'm trying the module described in the FAQ section of the General Discussion Group
:

I've tried this procedure as a straight forward 'copy & paste' into two functions as indicated in the FAQ. When I execute the 'Disable' section I get a 'Type Mis-match' error. Could there be a specific reference that I'm missing ?

The Debug Window drops in at :-
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)

Any Hints ??

solo7
 
Here you go! From:
Prevent users from disabling Access startup actions (97/2000)

When an Access database is configured to perform actions at startup, whether through a startup from an AutoExec macro, users can stop the actions from executing by holding down the [Shift] key while the database is opening. To prevent this from happening, you can use VBA to stop the [Shift] key's ability to skip startup actions. To do so, you need to set the AllowBypassKey property equal to False. Unlike the properties you're used to working with, this property is user-defined, meaning you need to define the property with code and append it to the database's Properties collection. The property is persistent, so it remains in the collection after you close the database, unless you specifically delete it.

To create a simple procedure to make and set the AllowBypassKey property, choose Module from the New Object button menu. Then, enter the following code:

Function PreventBypass() As Boolean
Set prp = CurrentDb.CreateProperty("AllowBypassKey", _
dbBoolean, False, True)
CurrentDb.Properties.Append prp
Set prp = Nothing
End Function

You can run this code to create the AllowBypassKey property by simply clicking the Go/Continue button (Run Sub/UserForm in Access 2000). Note that if you're using Access 2000, you'll need to have a reference to the DAO library to use this code (if you want, you can remove the reference after you've set the property).

When you're making changes to the database as a developer, you may want to re-enable the [Shift] key's bypass functionality. You can do this by setting the AllowBypassKey property to True, using a statement similar to

CurrentDb.Properties("AllowBypassKey") = True

You can also remove the property completely from the Properties collection to restore the [Shift] key's default behavior. To do so, use the Delete method in a statement such as

CurrentDb.Properties.Delete "AllowBypassKey"
 
That's brilliant cheers !!

solo7 ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top