Hi . I am trying to filter a crosstab query using tempvars! e.g.From a table 'Paid' Field "PayDate" where criteria "between [TempVars]![SeasonStart] AND [TempVars]![SeasonEnd]" i.e. [TempVars]![SeasonStart] = #1/9/2011# and [TempVars]![SeasonEnd] = #31/8/2012#.
The engine states [TempVars]![SeasonStart] not recognised, except when I use exactly same syntax in a Select query there is no problem. e.g. I have tried creating a sub query 'qPaidSub' using a Select query (using the above filter) and then referencing the sub query in the CrossTab, but still receive the same 'not recognised' problem.
I guess crosstab queries are sensitive to using variables, but as new starter to Access I am unable to find a workround (after 3 days ). Many thanks in anticipation.
NB I would prefer a non VBA solution if possible as I have a longer term hope to publish results on the web!
The SQL looks like the following:
TRANSFORM Sum(Paid.Amount) AS SumOfAmount
SELECT Paid.ClubRef, Sum(Paid.Amount) AS [Total Of Amount]
FROM Paid
WHERE (((Paid.PayDate) Between [TempVars]![SeasonStart] And [TempVars]![SeasonEnd]))
GROUP BY Paid.ClubRef
PIVOT DatePart("m",[PayDate]) & DatePart("yyyy",[PayDate]);
The engine states [TempVars]![SeasonStart] not recognised, except when I use exactly same syntax in a Select query there is no problem. e.g. I have tried creating a sub query 'qPaidSub' using a Select query (using the above filter) and then referencing the sub query in the CrossTab, but still receive the same 'not recognised' problem.
I guess crosstab queries are sensitive to using variables, but as new starter to Access I am unable to find a workround (after 3 days ). Many thanks in anticipation.
NB I would prefer a non VBA solution if possible as I have a longer term hope to publish results on the web!
The SQL looks like the following:
TRANSFORM Sum(Paid.Amount) AS SumOfAmount
SELECT Paid.ClubRef, Sum(Paid.Amount) AS [Total Of Amount]
FROM Paid
WHERE (((Paid.PayDate) Between [TempVars]![SeasonStart] And [TempVars]![SeasonEnd]))
GROUP BY Paid.ClubRef
PIVOT DatePart("m",[PayDate]) & DatePart("yyyy",[PayDate]);
Last edited: