"PC Datasheet" <no****@nospam.spam> wrote in
news:p%***************@newsread3.news.atl.earthlin k.net:
You can go to Tools -Startup and set "MyForn" to open when the
database opens, How do you do this programatically?
Look up CUSTOM PROPERTIES in Access Help. There's code there to set
custom properties.
Keep in mind that most Access properties don't actually exist until
you set a value. Thus, you can't programmatically set the startup
form until you've actually created that property. The code example
in the help file does exactly that, with a SetCustomProperty
function that works both when the property already exists and when
it doesn't (it uses an error handler to create the property if it
doesn't yet exist).
The code for changing the the property once it's been created is
actually quite trivial:
CurrentDB.Properties("StartupForm") = "MyForm"
I'm not sure where you can get a list of the official property
names, though. You can't just loop through the Properties collection
and output the names in the Debug Window, because the properties
aren't there until a value has been set.
Here's a list of the property names for the properties in the
Startup dialog:
Application Title AppTitle
Application Icon AppIcon
Display Form/Page StartupForm
Display Database Window StartupShowDBWindow
Display Status Bar StartupShowStatusBar
Menu Bar StartupMenuBar
Shortcut Menu Bar StartupShortcutMenuBar
Allow Full Menus AllowFullMenus
Allow Default Shortcut Menus AllowShortcutMenus
Allow Built-In Toolbars AllowBuiltInToolbars
Allow Toolbar/Menu Changes AllowToolbarChanges
Allow Viewing Code After Error AllowBreakIntoCode
Use Access Special Keys AllowSpecialKeys
I suspect that comes from a help topic somewhere, but I can't locate
it -- I'm just copying this from comments I've included in code
where I set the startup properties.
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc