Frank, you might also want to set the MDE's AllowBypassKey property, so a
user can't just hold down the Shift key to bypass your startup code.
Did you realise you can set the properties in the MDE after it has been
created? Create a small utility database for yourself, paste the code below
into a standard module, type in the correct name for your MDE file, and then
in the Immediate window:
? StartupProps(False)
Function StartupProps(bSet As Boolean)
Dim db As DAO.Database
Dim strDb As String
Dim strPrp As String
strDb = "C:\My Documents\MyFrontEnd.mde"
Set db = OpenDatabase(strDb)
ChangeProperty db, "StartupShowDBWindow", dbBoolean, False
Call ChangeProperty(db, "AllowSpecialKeys", dbBoolean, bSet)
Call ChangeProperty(db, "AllowBypassKey", dbBoolean, bSet)
db.Close
Set db = Nothing
End Function
Function ChangeProperty(dbs As Database, _
strPropName As String, varPropType As Variant, _
varPropValue As Variant) As Integer
Dim prp As Property
Const conPropNotFoundError = 3270
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Debug.Print strPropName & " is " & varPropValue
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