ShowToolbar method not working?


S

sbowman

I have all my toolbars hidden when my app opens up:

Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
'Hide the database window
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
Application.SetOption "ShowWindowsinTaskbar", False

I would like for my custom toolbar to show up when I open a report
so I have this in the report_open event:

DoCmd.ShowToolbar "MetricsReporting", acToolbarYes

I've done some debugging with the immediate window and found that
the showtoolbar method works if the menubars and toolbars are not
hidden. Is there a way to show just the one toolbar?
 
Ad

Advertisements

A

Albert D. Kallal

You doing this all wrong.....

If you start writing code to display, and then hide tool bars, you in for
using up huge amounts of money that could go to your local charity, or help
feed the poor.

You don't need (nor want) to write code to manage all those tools bars.

What happens if while you are viewing that report, the user switches back to
a form..and worse, if you have 5 forms open, then how do you plan to
coordinate what menu/tool bar shows as the user moves from one open form to
another, or starts closing some forms?
the same goes for when the user switches BACK to the report...how you now
going to display that menu bar?

It is just not realistic to try an code what menu bars show when forms
load...since users can then switch to other forms, and you then have to
start trying to code all of those cases......

So, don't try and code what menu bar shows from form to form (use that money
to feed the poor!!!).

The simple solution here is to use the tools->start-up, and simply un-check
(hide) all of the extra tool bars before you deploy the application.

The options to complete hide and keep people out of the ms-access interface
can easily be done using the tools->start-up options. Using those options
allows you to complete hide the ms-access interface (tool bars, database
window etc). Also, using these options means you
do not have to bother setting up security, or write a bunch of code.

Try downloading and running the 3rd example at my following web site that
shows a hidden ms-access interface, and NO CODE is required to do
this....but just some settings in the start-up.

Check out:

http://www.members.shaw.ca/AlbertKallal/msaccess/DownLoad.htm

After you try the application, you can exit, and then re-load the
application, but hold down the shift key to by-pass the start-up options. If
want, you can even disable the shift key by pass. I have a sample mdb file
that will let you "set" the shift key bypass on any application you want.
You can get this at:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

Take well note of how that sample download *CHANGES* THE menu bars when you
launch a different form, and the same applies when you launch report (you
use the "other" tab of the reports properties sheet to "set" what menu bar
shows...you don't need code. This also how those forms change menu bars when
you switch, or view a different form...so, simply use the "other" tab of the
forms property sheet.

just take a look at the above sample...and note how it don't take any code
at all.....
 
Ad

Advertisements

M

Marshall Barton

sbowman said:
I have all my toolbars hidden when my app opens up:

Dim i As Integer
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = False
Next i
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
'Hide the database window
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
Application.SetOption "ShowWindowsinTaskbar", False

I would like for my custom toolbar to show up when I open a report
so I have this in the report_open event:

DoCmd.ShowToolbar "MetricsReporting", acToolbarYes

I've done some debugging with the immediate window and found that
the showtoolbar method works if the menubars and toolbars are not
hidden. Is there a way to show just the one toolbar?


Use the report's Toolbar property to specify its custom
toolbar.
 

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

Top