SSRS how to show only month/year as a parameter using/customizing calendar control

BoCode picture BoCode · Sep 9, 2011 · Viewed 14.4k times · Source

I use SSRS 2005.I currently have two datetime parameters (for start and end dates) as parameters for my report. I get the default calendar controls to select the dates.

I want to show only month and year in the calendar control which can be selected by user. Is that possible?

I can create two text fields and let user enter month & year in each text field and i've two validate these two text fields. I dont want to do this because needs typing into the fields.

OR

I can create four dropdown lists for start month, start year and end month and end year with values but this involves clicking/scrolling a bit more. Dont want to do this either.

Can somebody suggest a solution?

Thank you Bo

Answer

niktrs picture niktrs · Sep 9, 2011

This cannot be done using the calendar control.

You can either use the calendar control ignoring the day or implement one of the other two solutions you mentioned.

In case of combobox, you can use select distinct month/year from your data to fill values.

To make this less annoying for your user's to run the report, default your month/year from/to values to these that usually the user selects to run the report.

Personally I would prefer textboxes with default values

eg. If user runs the report for current year from January to current month then the defaults would be

Month from: = 1
Month to: = Datepart("m", Now())
Year from, Year to: = Datepart("yyyy", Now())