cancel
Showing results for 
Search instead for 
Did you mean: 

Missing Page Header

Former Member
0 Kudos

Hi,

I have a report (my 3rd ever) that has a sub report. I put the sub report in the report footer section since I wanted it to print after the main report was finished. When I run the sub report by itself I get the right page headers, group breaks, etc. But when I run the main report with the sub report I get everything OK from the main report, then the sub report page header and the 1st sub report group. I have the group header set to do a page break when the group changes. I get my 2nd group of sub report data but there's no page header. I had to put a suppress (RecordNumber = Count(table.field) in the main report to keep it's page header from displaying on the sub report but this seems to be working fine and I don't see how it would affect the sub report.

What's my problem?

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I see. But when I say I have a sub report within a report I mean I have a sub report within a "main" report. The code works as far as the "main" report, sub report, etc. It just doesn't perform the way it should regarding the Page Headers. Thank you.

Former Member
0 Kudos

a sub-report will run as an object in a report just as a chart, crosstab or graphic would.

The sub-report may finish in a quarter page or in 30 pages. A sub-report (while generating) can not possibly know how many total pages will be in the main report.

Found this in the notes (kbases):

1217978 - How to display the main report's relative page number from the subreport

Symptom

When creating a report that contains a subreport, the 'Page Number' special field is inserted into the subreport.

When you preview the report, the 'Page Number' special field in the subreport displays the page number relative to the subreport, and not the page number relative to the main report.

How do you display the main report's relative page number on the subreport?

Resolution

To display the main report's relative page number on the subreport, use the following steps:

1. In the main report, create a formula called 'PageNumber' with the following text, excluding quotation marks:

"// @PageNumber

WhilePrintingRecords;

PageNumber;"

2. Right-click the subreport and click 'Change subreport links'. The 'Subreport Links' dialog box appears.

3. Link the subreport to the '@PageNumber' formula.

4. Open the subreport and replace the 'PageNumber' special field on the report with the '?Pm-?PageNumber' parameter.

When you now preview the report, the subreport displays the page number relative to the main report.

Former Member
0 Kudos

Mohamed,

Thanks much for your reply. Through experimenting I figured out that I could remove the page header and place the desired info in the group header for the sub report. This works great for the header but results in this problem:

I have a sub report within a report. The sub report has no page header or report header and uses a group header to separate and print the two groups of data. If I run the sub report as a standalone report the page numbering is fine. If I run it as a subreport within the main report the page numbering for the 2nd group is fine but for the 1st group:

If there's less than a full page of data the page numbering says 1 of 2

If there's 2 pages of data the page numbering says 1 of 2 then 2 of 2

If there's 3 pages of data the page numbering is 1 of 3, 2 of 3, 3 of 3

Since it works fine when run standalone it has to be something related to the main report, but I can't figure out where the "1 of 2" comes from in the 1st group when there's less than a page of data? FYI it only prints 1 page for group 1 even though it says Page 1 of 2.

Can someone help?

Former Member
0 Kudos

"I have a sub report within a report."

You may have a sub-report within a main report and within that sub-report you may have a hyperlink to another report but it could not possibly be a sub-report within a sub-report within a main report.

Crystal does not support sub-reports within sub-reports.

Former Member
0 Kudos

Hi Paul,

Subreports does not contain page header. If you wish to display a page header in subreport, fake header needs to be created.

Follow these steps to create a fake page header in the subreport.

1.Create a fake page header formula and enter

whilereadingrecords;

true;

2.Select 'Insert' menu and click 'Group'. Select the fake page header formula. Select Group Expert dialog box. Click Options on the Change Group Options tab, select 'Repeat Group Header on Each Page' option, and click 'OK'.

3.Use the up arrow to move this newest group up to the top of the list.

This ensures that the fake group is repeated on every page.

Regards,

Mohamed