Page Headers on Sub-Reports and Custom Page Headers

Published on
14,749 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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Join & Write a Comment

With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month