Showing posts with label variabl. Show all posts
Showing posts with label variabl. Show all posts

Monday, March 12, 2012

Passing A Date Parameter With A Month And Year As Separate Variabl

I have a query that contains the following part:
WHERE DOCDATE < @.Year + @.Month + '01'
This is supposed to allow me to find only the records before the month and
year selected. If I enter integer values for year and month, the query
returns the expected results. If I pass the parameters through the report
(where the user can choose the names of the month as opposed to the integer
value), the report does not return any results even though the year and month
data types are set as integers and the values being passes are integers, not
the month string itself(the 'label'). Can anyone help me reformulate my query
to get this working properly?
Thanks.On Nov 20, 4:48 pm, Zack <Z...@.discussions.microsoft.com> wrote:
> I have a query that contains the following part:
> WHERE DOCDATE < @.Year + @.Month + '01'
> This is supposed to allow me to find only the records before the month and
> year selected. If I enter integer values for year and month, the query
> returns the expected results. If I pass the parameters through the report
> (where the user can choose the names of the month as opposed to the integer
> value), the report does not return any results even though the year and month
> data types are set as integers and the values being passes are integers, not
> the month string itself(the 'label'). Can anyone help me reformulate my query
> to get this working properly?
> Thanks.
What you could do is create a Parameter (example it ChosenDateTime)
that is DateTime, Internal, with a Default Value of Non-queried:
= DateSerial( Parameters!Year.Value, Parameters!Month.Value, 1 )
then use
WHERE DOCDATE < @.ChosenDateTime
-- Scott