Search code examples
crystal-reports

Crystal Reports - Suppress a Page Header if the page has 0 records


I'd like to suppress a page header if the page has no data records.

Notes

  • The page may still need to display in order to show the group or report footers.
  • I'm interested in the case where there are no records for the details section of the report for the current page. I'm referring to a situation where all details records have been displayed for a group, but the group footer wraps to the next page.

Solution

  • 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.