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!

Setting the "AllowBypassKey" Property

Status
Not open for further replies.
Sep 1, 1999
7
0
0
US
I am trying to disable the Bypass option for the Startup properties of a database. I cannot figure out how else I can restrict users from viewing the database window of my application by using the SHIFT key while opening the application. Converting into MDE also does not help in preventing the bypass option.

There is a property called "AllowBypassKey" but I cannot figure out how to set it. Any help is appreciated.

Thanks.

DolphinFan
 
I think I modified code from the Access 97 help file... but here is a couple of functions to use. I put the NoByPass function in a macro... I create the MDE and then run the macro in the MDE. This way I have my source that is easy to work with. You could always open your database from another file and clear the property if you make a mistake.

Function NoByPass()
Dim varResult As Variant
varResult = AllowBypassKeyFalse
If varResult = True Then
MsgBox "Bypass startup key will now be disregarded."
Else
MsgBox "Unable to disable bypass startup key."
End If
End Function

Function AllowBypassKeyFalse() As Integer
Dim dbs As Database, prp As Property
Dim strPropName As String
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
strPropName = "AllowBypassKey"
On Error GoTo AllowBypassKeyFalse_Err
dbs.Properties(strPropName) = False
AllowBypassKeyFalse = True

AllowBypassKeyFalse_Exit:
Exit Function

AllowBypassKeyFalse_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, dbBoolean, False)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
AllowBypassKeyFalse = False
Resume AllowBypassKeyFalse_Exit
End If
End Function
 
i call the DISABLE code in autoexec macro, so it always disables it.

then i put an invisible button on main screen -- i click that when i need the shift key enabled for me. it makes it enabled (you dont see anything happen), then i re-open db using shift key.

g
 
Also, if you're serious about locking out users, don't forget about the F11 shortcut, toolbar options, right-clicking on forms to bring up design view option, or users accidentally debugging into your code.

I learned the hard way after my users found a couple of these tricks. Here's a faq that may help you. faq181-1021.

Go Broncos! Maq B-)
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top