Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: how to pass date range to sub report Post Reply Post New Topic
Author Message
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Topic: how to pass date range to sub report
    Posted: 04 May 2010 at 4:54am
I have a main report and sub report that are linked by an account ID field. I am brining in a shared value from the sub report into the main report that is used in some formulas. That is all working fine. I also have the main report setup to allow the user to enter a date range.  How can I pass on the date range from the main report to the sub report so both report give me the correct date range?

I am Using CRXI if that helps
Thanks,

Bill


Edited by flanman - 04 May 2010 at 4:58am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 May 2010 at 5:15am
are you using one param with a min and Max value or are you using 2 params (start date and end date)?
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Posted: 04 May 2010 at 5:27am
I am using two parameters (StartDate and EndDate).
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 May 2010 at 5:34am

Create two formula fields in the main report to be used for passing the params to any sub report. One for StartDate2 and one for EndDate2

@StartDate2 will be
{?StartDate}
 
 
@EndDate2 will be
{?EndDate}
 
Now right click on the sub report and select Change Sub Report Links
Select @StartDate2 and move it into Fields to link on
Select @EndDate2 and move it into Fields to link on
Select OK
Go into the sub report.
You should now see 2 new params
Go into the select expert and use them to limit your data
Table.Field in {?Pm-@StartDate2} to {?Pm-@EndDate2}
IP IP Logged
flanman
Senior Member
Senior Member
Avatar

Joined: 04 Nov 2009
Online Status: Offline
Posts: 123
Quote flanman Replybullet Posted: 04 May 2010 at 6:24am
As usual it worked like a charm. Once again. Thank you.
IP IP Logged
Hummels
Newbie
Newbie
Avatar

Joined: 12 Jun 2014
Location: United States
Online Status: Offline
Posts: 1
Quote Hummels Replybullet Posted: 12 Jun 2014 at 12:19pm
I'm running Crystal Reports 7. I ended up doing just this with a Date Range parameter I needed to send to a Sub Report. But, I also have a Multiple Value Parameter for choosing Users to run a report on. So there could be 1 Username, 5 Usernames or X Usernames. The best I can do is to get it to recognize the FIRST Username that is put in. Works fine in the Main report, If I run the Sub Report, it also works. Just not when the Main Report links the parameter to the Sub Report. Is this not possible in CR7?
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.