Scenario:
You have a report and you want to display a message that tells the user there were no records returned instead of having Crystal show a blank
page or an empty template.
Solution:
- Create a formula named "RecordCount" as the following:
WhileReadingRecords;
Global Numbervar RecordCount;
RecordCount:=RecordCount+1;
- Put the "RecordCount" field into the reports detail section. Supress the field by checking "Supress" on the format editor.
- Create a page header section by right clicking the page header section and choose "insert section below" from the context menu.
- Right click the page header you just created and choose "Section Export" from the context menu. In the section expert check the "Underlay Following Sections" checkbox.
- Click the conditional formula editor button to the right of the suppress checkbox. Set the formula to be:
Not(Isnull({@RecordCount}))
- Add a text object to the report that contains the message you want to display to the user when no data is returned.