John Bartow
john at winhaven.net
Wed Nov 26 16:04:56 CST 2003
John:
What I do is have my standard info screen as the start up form. That form
has two small transparent command buttons (cmdABKT and cmdABKF) on it in a
place no one thinks to double click. These allow me to set the bypass key on
or off as I need to. (The database window is hidden on startup of course)
You could just have a security warning form come up too. Heck, you could
even log the system user name while your at it, maybe even tell them your
logging it. Have some fun, scare the jeebies out of them!
:o)
Here's the code I use, if you find any gaping wholes in it or something let
me know.
John B.
Code Start
--------------------------------------------------
Private Sub cmdABKT_DblClick(intCancel As Integer)
' Comments : turns on bypass key option
ChangeProperty "AllowBypassKey", dbBoolean, True
End Sub
Private Sub cmdABKF_DblClick(intCancel As Integer)
' Comments : turns off bypass key option
ChangeProperty "AllowBypassKey", dbBoolean, False
End Sub
Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
' Comments : changes submitted property value
' Parameters : strPropName
' varPropType
' varPropValue -
' Returns : Integer -
Dim dbs As Database
Dim prp As Property
Dim strMsg As String
Dim varReturn As Variant
Const conPropNotFoundError As Long = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
'set property
dbs.Properties(strPropName) = varPropValue
'read property
Set prp = dbs.Properties(strPropName)
strMsg = prp
MsgBox strMsg
ChangeProperty = True
Change_Exit:
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_Exit
End If
End Function
--------------------------------------------------
Code End