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!

Disable special keys in VBA

Status
Not open for further replies.

Raymondo1

Programmer
Mar 21, 2004
3
GB
Hi All, hope you can help with this.

I am looking for the code to disable special keys in VBA.
I know that you can use the startup option however i want to allow special key use for specific people.



 
I'm not 100% sure of this but I think if you change this setting programmatically you will have to close the database and re-open again for it to be effective.
 
The code below will allow you to set the Startup properties.

The property has to be created before it can be set, but it can be set as it is created (if you see what i mean).

But as I said before you have to close the file and re-open for a change to take effect.

Usage:

CreateProps 3

The final 0 for each statement can be 0 or 1 depending on whether you are unsetting or setting the option.

Sub createprops(x)

Dim prp As DAO.Property
Dim db As Database
Set db = CurrentDb()
Select Case x
Case 1
Set prp = db.CreateProperty("StartUpShowDBWindow", 1, 0)
db.Properties.Append prp

Case 2
Set prp = db.CreateProperty("AllowBreakIntoCode", 1, 0)
db.Properties.Append prp
Case 3
Set prp = db.CreateProperty("AllowSpecialKeys", 1, 0)
db.Properties.Append prp
Case 4
Set prp = db.CreateProperty("AllowToolbarChanges", 1, 0)
db.Properties.Append prp
Case 5
Set prp = db.CreateProperty("AllowFullMenus", 1, 0)
db.Properties.Append prp
Case 6
Set prp = db.CreateProperty("AllowBuiltInToolbars", 1, 0)
db.Properties.Append prp
Case 7
Set prp = db.CreateProperty("AllowByPassKey", 1, 0)
db.Properties.Append prp
Case Else
'do nothing
End Select

End Sub
 
thanks alot guys...i will give these methods a try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top