Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Continue Page Numbering in Subreports

Status
Not open for further replies.

alollgm

Technical User
Dec 31, 2003
13
US
I'm working with Crystal Reports 8.5. I have a complex report with 5 subreports which may span multiple pages. I'd like to continue the page numbering that the main report controls. I have two page headers in the main report, they share a common variable for page numbering:

//@PageNumber
WhilePrintingRecords;
Shared NumberVar PageNum := PageNum + 1;

I also have the following placed at the main report header:

//@SetPageNumber
WhilePrintingRecords;
Shared NumberVar PageNum := 0

The page numbering seems to work fine up until the subreports span more than one page long. Then the page number simply repeats in the subreport section. If I place another formula in the subreport report header:
//@PageNumber2
WhilePrintingRecords;
Shared NumberVar PageNum := PageNum + 1;

The incorrect page number is shown in the main report page header but correctly when access @PageNumber2 in the subreport. (This case is true only if the subreport is exactly two pages long.) I realize that it is the order in which Crystal evaluates the formulas which is critical.

Is there a way for the subreport to tell the main report it spans x amount of pages?

Any suggestions on how to get the paging to work correctly for single or multiple page subreports?

Appreciate any help!

 
If you used "Special Field"->pagenumber in the page header of the main report, you shouldn't have this problem. Is there a reason you have chosen not to use this?

-LB
 
Special Field->pagenumber does not work correctly for reports with subreports.
 
I just tested it in 8.0 by placing it in the page header of a main report which had multi-page subreports and it worked perfectly.

-LB
 
What LB is saying is that you use the page number ONLY in the main report, not in the subs.

If you are getting unusual results, please post what's happening, it should work.

Also apply the service pack in case that has soemthing to do with it:


You can manually control page numbers from within a report/subreport by passing a shared variable and incrementing it, but you would have to display the page numbers from within the subreport when in the subreport I think.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top