You can use the StartupForm property to specify the name of the form that opens when your database first opens. For example, you can use this property to display a specified form that contains a menu of all available forms, queries, and reports within a Microsoft Access application when the database opens.
The StartupForm property is a string expression that is the name of a form in the current database.
You can set this property by using a macro or Visual Basic. You can also set this property using the Display Form option in the Startup dialog box, available by clicking Startup on the Tools menu. This is the easiest way to set this property.
The StartupForm property is preferred over the OpenForm action in the AutoExec macro. Because Microsoft Access runs the AutoExec macro after it parses the startup properties, your application should not use an OpenForm action in its AutoExec macro if the StartupForm property is set.
If this property is blank, the Microsoft Access default database setting is used (the Database Window opens).
This property’s setting does not take effect until the next time the application database opens.
AllowBreakIntoCode Property, StartupMenuBar Property, StartupShortcutMenuBar Property, StartupShowDBWindow Property, StartupShowStatusBar Property.
This example shows procedure named SetStartupProperties that passes the name of the property to be set, its data type, and its desired setting. The general purpose procedure ChangeProperty attempts to set the startup property and, if the property is not found, uses the CreateProperty method to append it to the database properties collection. This is necessary because these properties do not appear in the properties collection until they have been set or changed at least once.
Sub SetStartupProperties() ChangeProperty "StartupForm", dbText, "Customers" ChangeProperty "StartupShowDBWindow", dbInteger, False ChangeProperty "StartupShowStatusBar", dbInteger, False ChangeProperty "AllowBuiltinToolbars", dbInteger, False ChangeProperty "AllowFullMenus", dbInteger, True ChangeProperty "AllowBreakIntoCode", dbInteger, False ChangeProperty "AllowSpecialKeys", dbInteger, True ChangeProperty "AllowBypassKey", dbInteger, TrueSub ChangeProperty(strPropName As String, varPropType As _ Variant, varPropValue As Variant) As Integer Dim dbs As Database, prp As Property Const conPropNotFountError = 3270 Set dbs = CurrentDb On Error GoTo Change_Err dbs.Properties(strPropName) = varPropValue ChangeProperty = True_Bye: Exit Function_Err: If Err = conPropNotFoundError Then 'prop not found Set prp = dbs.CreateProperty(strPropName, _ varPropType, varPropValue) dbs.Properties.Append prp Resume Next Else ' Unknown error. ChangeProperty = False Resume Change_Bye End IfFunction