Control toolbar visibility from code?

S

Steve Marshall

Hi all,

Can I control toolbar visibility from code? I have an application which
will be used by most users as an MDE. I would like to detect if it is
running as an MDE (I've figured out how to do that), and if so, turn off
most of the standard toolbars. I've looked in many places, but haven't
found the key - yet. Anyone know the trick?
 
N

Nikos Yannacopoulos

Steve,

Application.CommandBars("Database").Visible = True / False

or

Application.CommandBars("Database").Enabled = True / False

The toolbar name (Database in the example above) is the name as it
appears if you right-click on a toolbar. For the menu bar, the name is
"Menu Bar".

Note: whatever you hide/disable, make sure you restore it upon exiting
the app, or it will remain invisible / disabled for all Access apps run
on that machine!

HTH,
Nikos
 
M

Marshall Barton

Steve said:
Can I control toolbar visibility from code? I have an application which
will be used by most users as an MDE. I would like to detect if it is
running as an MDE (I've figured out how to do that), and if so, turn off
most of the standard toolbars. I've looked in many places, but haven't
found the key - yet. Anyone know the trick?


Another way is:

DoCmd.ShowToolbar "Menu Bar", acToolbarNo
 
S

Steve Marshall

Thanks for that, but for some reason this didn't work. The code executed
without error, but the toolbars remained visible. It was as though the
Tools|Startup settings were overriding it. The method suggested by the
other repondent worked fine.
 
Top