Hello!
I have a form with 2 date fields [txtDateStart] and [txtDateEnd], these 2 fields are used as parameters in my query, the syntax is right but then when I open my report I get the following message: "The Microsoft Jet database engine does not recognize "[the dates]" as valid field names or expression." When I try this with a report that contains text data, it is fine it works but when I try it with my chart report I keep getting that error.
Then, I took the date paramaters out of my query and decided to try playing around with the query that controls the row source of my chart in the report.
When I created the chart report with the wizard, this is the sql statement that I ended up with:
TRANSFORM Count(*) AS [Count]
SELECT TreatmentQuery.TreatmentDiscrepancy
FROM TreatmentQuery
WHERE (((TreatmentQuery.DateIncident) Between #1/1/2001# And #12/31/2001#))
GROUP BY TreatmentQuery.TreatmentDiscrepancy
PIVOT (Year([DateIncident]));
but if I try to change the WHERE clause to the following:
WHERE (((TreatmentQuery.DateIncident) Between [Forms]![frmDate]![txtDateStart] And [Forms]![frmDate]![[txtDateEnd]))
I get that same error as above. Why? Does anybody know how I get passed this one. How to use the fields from my form as parameters for my chart report?
Thanks!
=o)
I have a form with 2 date fields [txtDateStart] and [txtDateEnd], these 2 fields are used as parameters in my query, the syntax is right but then when I open my report I get the following message: "The Microsoft Jet database engine does not recognize "[the dates]" as valid field names or expression." When I try this with a report that contains text data, it is fine it works but when I try it with my chart report I keep getting that error.
Then, I took the date paramaters out of my query and decided to try playing around with the query that controls the row source of my chart in the report.
When I created the chart report with the wizard, this is the sql statement that I ended up with:
TRANSFORM Count(*) AS [Count]
SELECT TreatmentQuery.TreatmentDiscrepancy
FROM TreatmentQuery
WHERE (((TreatmentQuery.DateIncident) Between #1/1/2001# And #12/31/2001#))
GROUP BY TreatmentQuery.TreatmentDiscrepancy
PIVOT (Year([DateIncident]));
but if I try to change the WHERE clause to the following:
WHERE (((TreatmentQuery.DateIncident) Between [Forms]![frmDate]![txtDateStart] And [Forms]![frmDate]![[txtDateEnd]))
I get that same error as above. Why? Does anybody know how I get passed this one. How to use the fields from my form as parameters for my chart report?
Thanks!
=o)