I have run into several situations recently where I needed to have one Page Header for most of the pages but a different page header at the end of the report. It may be that you have an object in the report footer that might add several pages after the regular report pages. This could be a subreport, a crosstab or a large block of legal boilerplate. When this happens the Page Header for those pages may need to be different. For instance you may need to turn off the column headings for those extra pages or switch to a different heading on the page. So you need some type of flag to tell the report when to switch.
Sometimes this is as simple as suppressing the Page Header with the function OnLastRecord. This probably works 97% of the time. But there are times when this approach misfires. For instance when the last record of the report is the only record on the last page. Your Page Header will be OnLastRecord but you will still want the headings on that page over the last record’s data. So here is a more complicated but more reliable method.
- Insert a new subsection below your last Report Footer section
- Suppress this new subsection of the Report Footer.
- Create a formula field that says this:
BooleanVar RFPassed := True
- Place this formula in the suppressed Report Footer.
- Use the following suppress formula for the Page Header to be suppressed:
When the report gets to the suppressed Report Footer it triggers the formula which changes the variable from True to False. Every Page Header before that point will have seen the variable as False and won’t suppress the section. But after that point the Page Header will see the variable as True and will suppress the section.(For examples of my most popular formulas, please visit the FORMULAS page on my website.)