Sometimes there are details printing on the last page and sometimes the last page is just the Group or Report Footer. You may not want column headings on the last page if there are no details. I have seen and tried several methods to accomplish this but not all are reliable. For instance using “OnLastRecord” as a suppress condition will work most of the time, but will also suppress the headers when the last page still contains exactly one detail record. I have found the approach below to be the most reliable.
First you split the Details band into A and B subsections. You suppress Details B and use Details A for your visible fields. Then you create the following formula field and place it in Details B:
WhilePrintingRecords;
BooleanVar Ending := OnLastRecord
Last you use the following formula to suppress the Page Header, or the part of the Page Header with column headings:
WhilePrintingRecords;
BooleanVar Ending
A Boolean variable is False by default. The variable will only be True once the report has passed the last Detail A, which means that the last record has printed. If there is a page header after that point it will be suppressed, because the “Ending” variable is now True.
(For examples of my most popular formulas, please visit the FORMULAS page on my website.)