[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Page Headers on Sub-Reports and Custom Page Headers

Published on
14,829 Points
4 Endorsements
Last Modified:
Community Pick
Page headers and footers are naturally very useful. It would have been unthinkable to create a reporting engine without them. However, they are not printed on sub-reports, the rationale being that the main report provides them. If one needs sub-report page headers or needs to customise them in any other way not allowed for the built-in section, there is a trick to create one's own.

Group headers (but not footers) have the option “Repeat Section: yes”. This means that the header will become an additional page header over all pages of that group. Now if there was a way to create one single group...

It's quite simple:

Open the report in design view,
activate the “Sorting and Grouping” sheet,
enter as first “Field/Expression”: =1
set “Group Header: yes”,
display the group's properties,
set “Repeat Section: yes”.
custom page headerThat's it. The header will behave almost like a page header: it can include page numbering expressions like “=Page” or “=Page & ' of ' & Pages”, labels, horizontal rulers, etc. If there is also a regular page header, it will always come second. The differences are that:

it will print when the report is a sub-report,
it can grow and shrink,
it appears after the report header on the first page.
If the last point is a problem, the page header can be modified to mimic the custom page header, which can be turned off on the first page. This trick is not explained in detail here, but one solution is the following “on print” event hander:
Private Sub MyPageHeader_Print(Cancel As Integer, PrintCount As Integer)
    Cancel = (Page = 1)
End Sub

Open in new window

The question about page headers in sub-reports is one of those recurring questions on Experts Exchange: why do they disappear? how do I get them back? The next time, I will provide a link to this page for the long version of the answer.

Markus G Fischer

This article is part of the EE-book unrestricted Access.

Featured Post

10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month