"PC Datasheet" <no****@nospam. spam> wrote in
news:p%******** *******@newsrea d3.news.atl.ear thlink.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 programmaticall y set the startup
form until you've actually created that property. The code example
in the help file does exactly that, with a SetCustomProper ty
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.Prope rties("StartupF orm") = "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 StartupShowDBWi ndow
Display Status Bar StartupShowStat usBar
Menu Bar StartupMenuBar
Shortcut Menu Bar StartupShortcut MenuBar
Allow Full Menus AllowFullMenus
Allow Default Shortcut Menus AllowShortcutMe nus
Allow Built-In Toolbars AllowBuiltInToo lbars
Allow Toolbar/Menu Changes AllowToolbarCha nges
Allow Viewing Code After Error AllowBreakIntoC ode
Use Access Special Keys AllowSpecialKey s
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