Thanks for the suggestion. I added code in the OnFormat procedures for
ReportHeader, GroupHeader0, and ReportFooter to assign a value to a Text Box
in the report header section. I'm finding that the subreports are being
opened and formatted before the OnFormat events for the section is executed.
I had the idea of setting a global variable at these same OnFormat points
and checking that, but the results are the same. The subreport is being
processed before the section it is in.
And to top it off, the report Header OnFormat event happens again at the
very end of the report processing.
Just in case there's interest, when there is one group section displayed,
here's the order of the report opens, and reportheader, groupheader,
groupfooter, and reportfooter events:
-------------------------
Report_Open: Programs Activities Cumulative
Report_open: ZipDataGrandTotal
Report_open: ZipDataGrandTotal
ReportHeader_format: Programs Activities Cumulative
GroupHeader0_Format: Visual Arts
Report_open: ZipDataGrandTotal
GroupFooter1_Format: Visual Arts
Report_open: ZipDataGrandTotal
ReportFooter_format: Programs Activities Cumulative
ReportHeader_format: Programs Activities Cumulative
GroupHeader0_Format: Visual Arts
Report_open: ZipDataGrandTotal
GroupFooter1_Format: Visual Arts
---------------------
It's more of the same if there are multiple group sections. I sure can't see
any logic here..... Unless there's another brilliant idea, I guess I'm stuck
using a seperate subreport for the report footer.
Allen Browne said:
One (not very elegant) way might be to add an unbound text box to the
report. Then in the Format event of each section, set it to the value of the
section being processed: 0 = acDetail, 5 = acGroupLevel1Header, etc. To see
the numbers, open the Object Browser (F2 in code window) and see the members
of acSection.
In the subreport, you can then examine the value of the list box on the
parent report, e.g.:
=[Report].[Parent]![Text99]
and you should know what section the subreport was called from.
That's untested: let us know how you go.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
DocBrown said:
I'm trying to use the same subreport in a GroupHeader and Report Footer
but
have it formatted slightly differently, Highlight fields, headers, etc. Is
there a way to tell when a subreport is being formatted in the
GroupHeader,GroupFooter or ReportFooter, or other sections of a report?
I thought of using the report events, but I added debug.print statements
to
see the order of the events and it is making no sense. For example the
subreport in the ReportFooter gets an open before the ReportFooter On
format
event. And the subreport receives an open event multiple times.
Any pointers would be very welcome.