<<<<<<<<<<<For Microsoft Access 2002>>>>>>>>
Just put this code into a module and run the SetBypassProperty
Sub SetBypassProperty()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub
Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
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
<<<<<<<<<<<For Microsoft Access 97>>>>>>>>
Same thing, just for Microsoft Access 97
Sub SetBypassProperty()
ChangeProperty "AllowBypassKey", dbBoolean, False
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
Hope that helps,
Kevin S.
----------------------------------------
A. said:
Hi,
I'm trying to secure my database on a short timescale - I've created an
..mde file... Does anyone know what code I need or what actions I need to
take to prevent anyone from bypassing the start-up options by using the
'BypassKey' I've searched the online help and found that I can write a
macro and VB to set the 'AllowBypassKey' property of the database to 'False'
but dont' really know where to go from here. Any help greatly appreciated.