Question : Passing Query driven parameter to subreport not working

Hi,

I have an SSRS 08 Report Server I am designing in VS08 and this report has a subreport which takes two dates as parameters (A start date and end date) and returns a table of results.

Firstly, the main report is passed a user selected parameter which defines a date range. For this example, we'll say "Last Month" = 5

The main report has a Dataset which takes this parameter and calculates and returns the first and last date between a particular timespan, and returns those dates. So again, we would feed the 5 in this example to this query and it would return Start_Date, "2010-07-01 00:00:00.000" and End_Date, "2010-07-30 00:00:00.000"

I know this works, as if I run the main report with a textbox returning the results of that query I get the dates expected, so know they're being generated.

The Subreport takes two parameters @SD and @ED, which are unsuprisingly the start and end date of it's query and returns a list of appointments between those dates.

The problem is that when I pass the two dates to the subreport, it returns nothing (or if I disallow blanks/nulls, give the "subreport is missing a parameter" error).

If I test the subreport directly by hardcoding in the date returned by the Main Report query then it works and, most importantly if I pass the parameters with hardcoded values in, again this works, so I know it's not a problem with the Subreport.

In the parameter setting for the Subreport I am using this expression (in the case of SD):

=Format(First(Fields!start_date.Value, "DateRange"), "yyyy-MM-dd HH:mm:ss.FFF")

however, just using =First(Fields!start_date.Value, "DateRange") yields the same results.

Looking for advice as I can't work out why these query results are getting to a textbox I place on the main report, but not into the parameter fields for the subreport.

Many thanks.


Answer : Passing Query driven parameter to subreport not working

If DateRange is the Data-set that get returns in main report,
then create one Table in body of main report.
Set its dataset to "DateRange".
then add this sub-report inside the cell. Then set the report parameter directly.
You does not require to format it via expression.
Random Solutions  
 
programming4us programming4us