Reputation: 5933
When I set a default value formula for a date parameter in SSRS, such as:
=CDate(”01/” & Month(Now) & “/” & Year(Now))
or even:
=Now
the date parameter control becomes disabled with nothing in it. Does anyone know what simple thing (I am sure) I am doing wrong?
Upvotes: 16
Views: 10616
Reputation: 6496
A solution to this is to set the default value using a dataset (i.e. the "get values from a query" option) instead of an expression ("specify values" option). Then the parameter is not disabled upon load and the report doesn't refresh after selecting the first parameter. I'm not sure why it works this way, but it fixed the issue for a SSRS report I was working on that had the same problem.
Example: add a "DefaultDate" dataset to your report datasets with this query, then update your parameter to use this dataset as the default value:
select defaultDate = convert(date, getdate())
Upvotes: 0
Reputation: 1
I experienced the same and the problems lies on the USER ID parameter that I set to internal visibility but without any default value. When I put in default value or set this to null, the date parameter was enabled.. (User ID parameter comes before the date parameter on my case)
Upvotes: 0
Reputation: 5933
After playing some more, I realized that the date controls became enabled when I picked a value from a preceding dropdown parameter that did not have a default. Apparently, controls after non-default parameters are disabled until you pick something, so order matters.
From an MDSN article:
"parameter order is important when you want to show users the default value for one parameter before they choose values for other parameters"
http://msdn.microsoft.com/en-us/library/cc281392.aspx
Upvotes: 26
Reputation: 22920
Now
is a function and you must use like =Now()
maybe it is your problem.
Upvotes: -3