S
scott
I have a query to return the weeks in the year. I'm trying to use the public
variable iDefaultReportYear in the where part to limit the returned records
to the year a user sets the iDefaultReportYear variable to.
What I can't understand is what syntax to enclose the variable with. I've
tried () and [] to no avail.
Can anyone tell me how to change the below sql statement to treat
iDefaultReportYear as a variable and not a table, etc.?
SELECT DISTINCT WeekNumber([prod_date]) AS [Week #],
Format([prod_Date],"yyyy") AS [Year]
FROM tblDate
WHERE (Format([prod_Date],"yyyy"))=("iDefaultReportYear");
variable iDefaultReportYear in the where part to limit the returned records
to the year a user sets the iDefaultReportYear variable to.
What I can't understand is what syntax to enclose the variable with. I've
tried () and [] to no avail.
Can anyone tell me how to change the below sql statement to treat
iDefaultReportYear as a variable and not a table, etc.?
SELECT DISTINCT WeekNumber([prod_date]) AS [Week #],
Format([prod_Date],"yyyy") AS [Year]
FROM tblDate
WHERE (Format([prod_Date],"yyyy"))=("iDefaultReportYear");