Control toolbar visibility from code?

  • Thread starter Thread starter Steve Marshall
  • Start date Start date
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?
 
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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top