Crystal Reports - Suppress a Page Header if the page has 0 records
Assuming you have Keep Together checked for the group footer, try entering the following in the conditional suppress formula for the page header section in the section expert:
OnLastRecord or {GROUP FIELD NAME} <> Next({GROUP FIELD NAME})
where {GROUP FIELD NAME} is the name of the grouping field.
OnLastRecord must come first in the formula, because if the last page of the report has no detail records (so that the page header should be suppressed), then Next({GROUP FIELD NAME}) evaluates as NULL and all conditions that come after it are also evaluated as NULL.
First, you have to create a formula. Then, insert it into to the Details section. For example @VariableA
Inside the formula, put this:
Shared NumberVar PageofLastField;
If OnLastRecord then PageofLastField := PageNumber;
Suppress formula.
The formula checks if the record is the last record. If it is the last record, it saves the Page Number where the last record is to the shared variable PageofLastField. Then on the Suppress formula of your header, put this code:
Shared NumberVar PageofLastField;
PageofLastField := PageofLastField;
if pageofLastfield <> 0 and PageNumber > PageofLastField
THEN TRUE
ELSE FALSE
Right-Click Page Header Choose Section Expert "Suppress (No Drill-Down)" is not Checked But add this formula: pagenumber = totalpagecount