Prev, code I had written switched in either one or another toolbar
depending on whether forms or a report had the focus.
Ouch!!!
I have applications with 160 forms, and the suggestion to manually code what
form will display what menubar (or now what ribbon) is going to be a
complete
night mare. The problem here is what are you going to do when the focus
switches between 5 open forms? Your suggesting for every new form that you
add to the application, you going to have to setup code to capture the
focus change, and then have code run that displays a particular menu bar?
That is a difficult approach.
And, what would (will) happen when you launch reports? Are you now to
capture the
focus change between 5 open reports, and 5 open forms? As you can see, this
gets
difficult real fast.
Focus changes of forms, or your reports SHOULD NOT take
code. I built my ms-access applications with menubars for 10+ years now.
I NEVER written code to switch the menu bar displayed.
All you do is simply specify what
menubar to display in the "other" tab of the forms property sheet.
If you done this right, then you not need code to change/display what
menubar shows.
The same approaches works in a2007. Simply specify what ribbon to display in
he other tab.
When
you switch between 5 open forms and 5 open reports, you not have to write
one line of
code......
Another helpful tip is to build a custom menu for your reports. for those
10+ years, I re-used the same menubar for all reports. I built one with a
email button and few other features that I liked.
I Simply specify that menubar for every report. I can't even remember
building the menubar..it been that long ago!!
So, it rather simple
process that when you build a new report, you simply set the menu bar in the
"other" tab of the properties sheet (or now, you simply set the ribbon).
When you switch between forms and a report..the correct menu bar (or ribbon)
will display for you (get access to do all the dirty work here. I never did
try coding what menu bar should show..it just seems to complex to attempt
that).
So, a2007, you can do *exactly* the same thing. You not have to write ONE
line of
code to switch, or tell ms-access what ribbon to display. I never did
before..and don't now.
For reports, just build a custom ribbon, and use that for all reports. Here
one that took less time to build then to type this response:
<customUI xmlns="
http://schemas.microsoft.com/office/2006/01/customui"<ribbon startFromScratch="true">
<tabs>
<tab id = "MyReprots" label="Reports">
<group idMso="GroupPageLayoutAccess" />
</tab>
</tabs>
</ribbon>
</customUI>
I saved the above as "MyReprots" in the usysRibbon table.
I suppose we should add the "view"..print..and few out ribbon groups to the
above. (you do know how to quickly and easily lookup the idMso
above..right?).
Now, in the reports "other" tab of the property sheet, just specify the
above. When you launch a report, it will display the standard page layout.
So, try the above approach, it works well.
As for your other post, I don't know why the sample instructions in the help
file don't work for hiding the ribbon. I just tried it..and it worked fine
for me...