Keep in mind that changing some of these settings may not "take" until
the next time the db is opened.
In a general module:
*************************************
Dim g_bolInDesign as Boolean
Public Sub DbStartup()
gloInDesign = True
SetDAOObjectProperty CurrentDb, "StartupForm", dbText, "frmStartup"
SetDAOObjectProperty CurrentDb, "StartupShowDBWindow", dbBoolean,
g_bolInDesign
SetDAOObjectProperty CurrentDb, "StartupShowStatusBar", dbBoolean,
True
SetDAOObjectProperty CurrentDb, "AllowBuiltinToolbars", dbBoolean,
g_bolInDesign
SetDAOObjectProperty CurrentDb, "AllowToolbarChanges", dbBoolean,
g_bolInDesign
SetDAOObjectProperty CurrentDb, "AllowFullMenus", dbBoolean,
g_bolInDesign
SetDAOObjectProperty CurrentDb, "AllowShortcutMenus", dbBoolean,
True
SetDAOObjectProperty CurrentDb, "AllowSpecialKeys", dbBoolean,
g_bolInDesign
SetDAOObjectProperty CurrentDb, "AllowBreakIntoCode", dbBoolean,
False
SetDAOObjectProperty CurrentDb, "AllowBypassKey", dbBoolean,
g_bolInDesign
End Sub
Public Function SetDAOObjectProperty(objDAOObject As Variant, _
strPropName As String, varPropType As Variant, varPropValue As Variant)
As Integer
' Set properties of a DAO object (i.e., database, table, field).
' If property doesn't exist, it will be created.
' * Requires reference to DAO library
Dim prp As dao.Property
Const conPropNotFoundError As Integer = 3270
On Error GoTo ErrHandler
' Compare and change only if different
If objDAOObject.Properties(strPropName) <> varPropValue Then
objDAOObject.Properties(strPropName) = varPropValue
End If
SetDAOObjectProperty = True
ExitHere:
Set objDAOObject = Nothing
Set prp = Nothing
Exit Function
ErrHandler:
If Err = conPropNotFoundError Then
' Property not found: create it, append it
Set prp = objDAOObject.CreateProperty(strPropName, varPropType,
varPropValue)
objDAOObject.Properties.Append prp
Resume Next
Else
' Unknown error.
' * Function not included in post: Call ErrorLog(mDocName,
"SetDAOObjectProperty")
SetDAOObjectProperty = False
Resume ExitHere
End If
End Function
***************************************
HTH,