Access JumpStart 2.0 | Blog

A Rapid Development Framework for Microsoft Access

I had another Access report challenge. In my previous workaround using a Subreport in the main Report Footer section, I was able to hide the page header on the final page. Unfortunately, this is where my Page x of y field was located which was also hidden. In this case the page header has lots of data and column titles that should appear on each page of that first section of the report.

If you just have one extra page like I did, you can actually just copy the page header page number field and paste it into your report footer below the page break. (Actually, I didn’t test this, but I think it would work).

What I did instead was a solution that would allow me to have page x of y over the course of the whole report.

Step 1 – I created a new custom top level group on the expression =”1″. This is simply a constant so I know there will be just one of these groups on the report.

Step 2 – I moved the page header content (except for the page x of y) into the new =”1″ Group Header and changed the Group Header settings to repeat. This ensured that the group header appears at the top of each page until the group is finished and the group footer reached.

Step 3 – I moved my report footer totals into the “=1” Group footer.

At this point, my page header only has the page x of y in it and it will appear on every page of the report including any additional pages the subreport causes.

I performed a few extra tricks here in order to put the page x of y back in line with the new group header by copying the field and pasting it into the group header.

Then I set the page header property Visible to “No”

Finally I added code to make the page header property visible again in the Print event of the Report Footer. This happens the first time the Report Footer prints and then on subsequent pages (after my embedded page break in the report footer). So the page header is now displayed for all the subreport pages that get generated and my PDF that gets created is perfect!)

This makes my client happy!