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

Need Help with Parameter - AGAIN

Status
Not open for further replies.

goduke

IS-IT--Management
Feb 13, 2006
65
US
I have built a report that has a parameter for a date range. You enter the date range and it displays the data on the report based on that date range. But I also have a subreport that displays the same data for the last 7 days based on the currentdate. What I want to do is be able to run the main report, and the subreport show data based the last 7 days of the date range in the main report. Which means if I run the main report for 3/1/2007 - 3/7/2007 then I want the subreport to pull 7 days prior to 3/1/2007. Is this possible?
 
It is possible by simply using your parameter to link to the date within the selection criteria of the sub report.

For example :-

Date range parameter called {?Daterange}

Create a formula called {@startdate}

//startdate
minimum{?daterange}

Edit the subreport links and link your subreport as {@startdate} in main report to whichever tabledate in subreport.

Then within your subreport selection criteria select based on:

{table.date} >= {?pm-@startdate}

Hopefully that makes some kind of sense. :D

'J
 
Thank you for your response. I was finally able to get parameter passed from the main report into the subreport, using the formula. Now I am confused on what I should use for my selection criteria in the subreport. Right now I am using:

{Table.Completed_Date} >= DateAdd("d",-7,{?Pm-@startdate})

I am trying to pull 7 days prior to the @startdate only, and I am getting way more records than that. Before, when I used

{Table.Completed_Date} >= DateAdd("d",-7,(currentdate))

it worked fine.
 
Try the following

{Table.Completed_Date} in [DateAdd("d",-7,{?Pm-@startdate}) to DateAdd("d",-1,{?Pm-@startdate})]

-lw
 
Thanks again for the response. That worked perfectly. Now, if I could pick your brain one more time. I have 3 more subreports underneath this one. One shows previous 30 days, one shows previous 60 days, and one shows all days up to the date you run the main report. What would be my selection criteria in each subreport? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top