Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

12.10 Editing the Subreport

Editing the Subreport

Once the subreport object has been added to the main report, you will probably need to edit it. Depending upon the types of changes you want to make to the subreport, there are different ways of editing it.

To edit the content of the subreport, from the main report either double-click on the subreport object or right-click on it and select Edit Subreport. This opens the subreport in the same design tab as the main report. The subreport is now treated the same as any other report. You can add new report objects, modify existing ones, or delete report objects.

When editing a subreport, the report designer changes so that it displays tabs at the bottom of the designer. Each tab lists the name of the main report and all open subreports. This lets you move back and forth between the main report and its subreports. This is shown in Figure 12-6.



Figure 12-6. The tabs that list the main report and open subreports.

If you have a main report that uses many subreports, you may find that you can’t open them all and see their tabs listed at the bottom of the designer. At the bottom right-hand corner of the designer are two arrows. Click on them to scroll through the open subreports.

You can also modify other aspects of the subreport. When viewing the main report in design mode, right-click on the subreport object and there are two menu options called Format Object and Change Subreport Links. The Format Object menu item opens the standard format dialog box where you set properties such as Suppress, Keep Object Together, etc. The formatting options on the Border, Subreport and Font tabs control how on-demand subreports are displayed on the main report. This is discussed in the next section. The Change Subreport Links menu item opens the Subreport Links dialog box. This lets you change the fields that are used to link the main report to the subreport.

Question: My subreport doesn’t have any data in it, but it still prints the column headers on the report. Is there a way to hide subreports that don’t have any data?

Answer: Yes, there is. Hiding an empty subreport is a two step process. First, in the main report, right-click on the subreport and select Format Object. On the subreport tab, check the option Suppress Blank Subreport and click the Ok button to close it. Second, put this subreport in its own section (it has to be isolated from all other report objects) and right-click on the section header to select Section Expert. On the Section Expert dialog box, select the option Suppress Blank Section. This hides the section if it is blank, and since the subreport is also suppress, then nothing will print on the report.