Help with toolbars

  • Thread starter Thread starter IceTy Mbatha
  • Start date Start date
I

IceTy Mbatha

Hi

I have a custom tool bar that I want it to appear when a certain form is
opened. I have this code in the GotFocus event of the form
Me.Toolbar = "Reports"
Reports is the name of the toolbar. This is not working. What could be
wrong?

Thanking you guys in advance
 
Set the form's Toolbar property to Reports in the form's properties sheet.
You can do the same for a menu with the form's MenuBar property.

Ken Sheridan
Stafford, England
 
Isn't there a Toolbar property for the form? (I don't have Access here
to check.) Look in the form properties. IIRC, you don't need any code.
 
Me.Toolbar = "Reports"

my guess is that "reports" is not a tool bar..but is a menu bar....

Try setting this manually in the forms "other" tab. There is a setting for
both a menu bar, and also a tool bar. If your bar is not setup correctly,
then you will NOT see the option into he drop down list. So, try this
manually first.

In fact, why bother trying to use the on-got focus event, when you can set
this in the other tab.

Further, trying to set the forms particular menu bar, or tool bar by using
the focus events is going to be a real night mare. When you have 5 forms
open, what events will you use to switch the menu bar?

However, to be fair, at least you are setting the forms property, and this
should work in your case....

Check the forms "other" tab..and try setting the toolbar manually...if your
tool bar does not appear in the dropdown list..then it is not a tool bar
(check the option right above...menubar...and see if it appears there).
 
Albert:

I suspect it’s not a problem with the CommandBar object per se, but with the
event procedure in which the property is being set. To set the Toolbar
property in code I think it would have to be done in the form's Open event
procedure. After the form loads is too late.

However, the only reason for doing it in code would be if when the form
opens different toolbars were to be shown in different circumstances, in
which case the property could be set conditionally in the Open event
procedure, governed by a value passed to the form via the OpenArgs mechanism
for instance. In a case like this one simply setting it in the form's
properties sheet is the obvious way to go.

To change a toolbar after the form has loaded it could be done by
hiding/showing a member of the CommandBars collection.

Ken Sheridan
Stafford, England
 
Good point...., and I just checked to be sure....

You *can* set the menu bar AFTER the form loads. you can even put the code
behind a regular button..and it works...

So, the original posters request is quite reasonable...and it should work.
Any where in the form, and even using the on-enter event for the sub-form
would allow one to change the menu bar.....
 
The "Reports" toolbars does exit, I can load it manuals. It does appear on
drop-down list properties of the form. I resorted to code when even
selecting the toolbar from the forms properties did not work.

After reading all your comments (thanks!!) I re-looked at my setting and I
think I have half of my solution. The form's pop-up property is set to Yes
and in this mode the toolbar does not appear whether you set it in code or
via the form's properties. If I set it No the toolbar works perfect. BTW, I
do need to pop-up the form.

:IceTy
 

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

Similar Threads


Back
Top