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

Set AllowBypassKey to false

Status
Not open for further replies.

Vinny1

Technical User
Feb 20, 2003
3
0
0
US
I want to set the allowbypasskey to false so that it can't be used on start up. I have found the following info in the help menu, but am not sure how to carry out what it describes to do. Any help would be much appreciated.

"To set the AllowBypassKey property by using a macro or Visual Basic, you must create the property in the following ways:

In a Microsoft Access database (.mdb), you can add it by using the CreateProperty method and append it to the Properties collection of the Database object."
 
Also, Can I disable the F11 button that shows the tables, querys etc?
 
Vinny,

The second part you do in the startup item of the tools menu when you're looking at the database window itself.

The first part takes a bit of code. That code is in the Security FAQ, which is on my website. I was just looking at it today, so I'm pretty sure it's on page 30.

Jeremy ==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Thanks for the response Jeremy. I went to your website and copied the code and included it in a modual in my database and nothing happened. The shift key still works. What am I doing wrong?
 
Vinny 1

This is the code that I use to set the bypass key. I have created a form to run the code this is works for me, its for ease of use, then just attached the code to the button.

Please note that in the code I have remarked the following line to ensure that I do not set the process until I an ready to package the product up.
'ChangeProperty "AllowBypassKey", dbBoolean, False

Private Sub Command0_Click()
'ChangeProperty "AllowBypassKey", dbBoolean, False
DoCmd.Close acForm, "frmSetAllowByPassKey"
End Sub


Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function

I hope this makes sense. It does work.

Cheers!!!!!!!!!!


Lou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top