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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreports not updating parameters in each report 1

Status
Not open for further replies.

grpeachtree

Technical User
Sep 5, 2012
7
0
0
I am using Crystal Reports 2008 with Peachtree Premium 2012 - PSQL is the database engine.

I created a report and saved it as a new report two additional times.
I opened the original report and inserted into the Report Footer A, a subreport which is a copy of the orginal.
I inserted into the Report Footer B, a subreport which is also a copy of the orginal.

When I refresh the report and enter the parameter for the main report, all the subreports display with the same data.
Why didn't the report ask for parameters (use current or new parameters) in subreport 1 and subreport 2?

I even tried entering new parameters for each report: main, subreport 1 and subreport 2.
The parameter is the date range for the report.
For the main report I enter 9/1/2011 through 11/30/2011 (3 months)
then for subreport 1 I enter 9/1/2011 through 2/29/2012 (6 months)
then for subreport 2 I enter 9/1/2011 through 8/31/2012 (12 months)

Each page header displays 9/1/2011 through 11/30/11 and all the data on the report is the same.
I want the main report to show 3 months of data, subreport 1 to show 6 months of data and subreport 2 to show 12 months of data.
What am I am missing?
 
I would just use one parameter {?StartDate} in main and sub reports. You can link parameters in subreport linking pane, drag main parameter into linking window and then find SR parameter in drop down list in lower left hand side

In select expert main report

datefield >= {?StartDate} and
datefield < dateadd("m", 3, {?StartDate})

in subreport1

datefield >= {?StartDate} and
datefield < dateadd("m", 6, {?StartDate})

same for SR 2 but with 9 months

Ian
 
Perfect!
Thank you, Ian.

I did exactly what you suggested.
I eliminated the {?Date Range} parameter and eliminated the selection statement {JrnlHdr.TransactionDate} = {?Date Range}.
In the main report, I added the parameter {?StartDate} and added the selection statement
{JrnlHdr.TransactionDate} > {?StartDate} and {JrnlHdr.TransactionDate} < dateadd("m", 3, {?StartDate})

I did the same for Subreport 1 and Subreport 2: eliminated {?Date Range} and the selection statement
{JrnlHdr.TransactionDate} = {?Date Range}. Then added the parameter {?StartDate} and added the selection statement
{JrnlHdr.TransactionDate} > {?StartDate} and {JrnlHdr.TransactionDate} < dateadd("m", 6, {?StartDate})
or < dateadd("m", 12, {?StartDate})
I edited the subreport linking and used {?StartDate} as the main parameter in the subreport 1 and 2.
I also selected {?StartDate} as the Subreport Parameter Field to Use in the ?Start Date Field Link area of the linking window.

Now, the subreports are displaying the correct data regarding the dates.

Thank you so much! You're a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top