J
Jon Rowlan
Trying to resolve a problem that I reported in the reports section, I am
struggling with queries that contain form variables.
If I use this :
SELECT * FROM ReportTestData WHERE (((ReportTestData.Year) Between
Forms!ExecSalesReport![Reference Year]-Forms!ExecSalesReport![Number Of
Years] And Forms!ExecSalesReport!ReferenceYear));
With the form on screen the query returns no rows.
However, if I close the form so that the query prompts for the answers and I
enter the same details as shown on my form, the query returns all the rows
that I need.
Can someone please tell me where I am going wrong? I'm sure its something
obvious but I just can't see it??
Is it that the query is comparing a field contents, quite literally, with
"Forms!ExecSalesReport!ReferenceYear" and why does this not come up with an
error rather than returning no rows?
thanks,
jON
struggling with queries that contain form variables.
If I use this :
SELECT * FROM ReportTestData WHERE (((ReportTestData.Year) Between
Forms!ExecSalesReport![Reference Year]-Forms!ExecSalesReport![Number Of
Years] And Forms!ExecSalesReport!ReferenceYear));
With the form on screen the query returns no rows.
However, if I close the form so that the query prompts for the answers and I
enter the same details as shown on my form, the query returns all the rows
that I need.
Can someone please tell me where I am going wrong? I'm sure its something
obvious but I just can't see it??
Is it that the query is comparing a field contents, quite literally, with
"Forms!ExecSalesReport!ReferenceYear" and why does this not come up with an
error rather than returning no rows?
thanks,
jON