Passing Date parameter to a subreport
I'm trying to get a subreport to accept two Date parameters, but it wont. I have: 1. The parameters as Date/Time parameters 2. the subreport parameter equivalent of the main reports date parameters are of the date type, and are not accepting nulls. 3. When i enter the dates in the subreport, it displays data correctly So I have come to the conclusion it's a passing problem. I have this: =FORMAT(FormatDateTime(Parameters!startDateRange.Value, DateFormat.ShortDate), "YYYYMMDD") =FORMAT(FormatDateTime(Parameters!endDateRange.Value, DateFormat.ShortDate), "YYYYMMDD") which originally were just the parameters, then just "FormatShortDates", but then I read they need to be in YYYYMMDD format to be passed correctly... is this true? Thanks
May 19th, 2011 2:43pm

bump anyone?
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2011 9:02am

Hi TheTurdFerguson, Thanks for your question.According to your description, I understand that you have one mainreport and one subreport, you want the subreport accept the two Date parameters that pass from main report in YYYYMMDD format, like “20110523”, but it does not work, right? If I misunderstand your question, please let me know. Actually,“20110523” is string format, we cannot pass a string to subreport’s date/time parameter, so the root cause of your scenario is type conflict, to solve the issue,I suggest you to pass parameters in yyyy/MM/dd format to subreport, for detail steps, pleases follow below: Supposing yourmain report has two Date/Time parameters, such as @MstartDateRange and @MendDateRange, the subreport has two Date/Time parameters too, such as @startDateRange and @endDateRange. 1:Right-click the subreporton the main report, and select Subreport Properties. 2:In the drop-down list of Use this Report As A Subreport, select your subreportname. 3:Click parameters tab, click Add Button, in the drop-down list of Name, select startDateRange, then click the expression button, please type in: =Format(Parameters! MstartDateRange.Value,"yyyy/MM/dd") or =FormatDateTime(Parameters! MstartDateRange.Value,2) 4:Click parameters tab, click Add Button, in the Name drop-down list, select endDateRange, then click the expression button, please type in: =Format(Parameters! MendDateRange.Value,"yyyy/MM/dd") or =FormatDateTime(Parameters! MendDateRange.Value,2) If you still need to make use of the parameters in YYYYMMDD format on the subreport, please try something like these: =Format(Parameters!startDateRange.Value,"yyyyMMdd"). =Format(Parameters!endDateRange.Value,"yyyyMMdd"). If you have any question, please feel free to let me know. For more information about How to: Add a Subreport and Parameters (Reporting Services), please see: http://msdn.microsoft.com/en-us/library/ms160348.aspx Thanks Sharp Wang
May 24th, 2011 4:29am

Hi TheTurdFerguson, Thanks for your question. According to your description, I understand that you have one mainreport and one subreport, you want the subreport accept the two Date parameters that pass from main report in YYYYMMDD format, like “20110523”, but it does not work, right? If I misunderstand your question, please let me know. Actually,“20110523” is string format, we cannot pass a string to subreport’s date/time parameter, so the root cause of your scenario is type conflict, to solve the issue,I suggest you to pass parameters in yyyy/MM/dd format to subreport, for detail steps, pleases follow below: Supposing yourmain report has two Date/Time parameters, such as @MstartDateRange and @MendDateRange, the subreport has two Date/Time parameters too, such as @startDateRange and @endDateRange. 1. Right-click the subreporton the main report, and select Subreport Properties. 2. In the drop-down list of Use this Report As A Subreport, select your subreportname. 3. Click parameters tab, click Add Button, in the drop-down list of Name, select startDateRange, then click the expression button, please type in: =Format(Parameters! MstartDateRange.Value,"yyyy/MM/dd") or =FormatDateTime(Parameters! MstartDateRange.Value,2) 4. Click parameters tab, click Add Button, in the Name drop-down list, select endDateRange, then click the expression button, please type in: =Format(Parameters! MendDateRange.Value,"yyyy/MM/dd") or =FormatDateTime(Parameters! MendDateRange.Value,2) If you still need to make use of the parameters in YYYYMMDD format on the subreport, please try something like these: =Format(Parameters!startDateRange.Value,"yyyyMMdd"). =Format(Parameters!endDateRange.Value,"yyyyMMdd"). If you have any question, please feel free to let me know. For more information about How to: Add a Subreport and Parameters (Reporting Services), please see: http://msdn.microsoft.com/en-us/library/ms160348.aspx Thanks Sharp Wang
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2011 4:30am

Hi, If in the Main report and the Subreport both the paramters are of Datetime format then while passing the values to the Subreport just give it as Parameters!ParameterName.Value. Hope its clear....Pavan Kokkula Tata Consultancy Services.
May 24th, 2011 6:49am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics