Counting records and Where criteria

T

Tony Williams

I'm trying to count the number of records between date parameters. I have a
query that I'm using the Count function to count the number of txtrefnbr and
in the Criteria I've used
Where [txtdaterecd]=Between [Forms]![frmdates]![txtfrom] And
[Forms]![frmdates]![txtto]
But I get an invalid syntax error. Anyone help?
Thanks
Tony
 
K

KARL DEWEY

Use --- Where [txtdaterecd] Between [Forms]![frmdates]![txtfrom] And
[Forms]![frmdates]![txtto]

No equal when using between.
 
A

Allen Browne

What is [txtdaterecd]?

If it is a field in a table, when you open the table in design view, is it a
Date/Time field?

If it is a calculated query field, wrap the calculation in CVDate() so
Access understands the data type.

If txtfrom and txtto are unbound text boxes, set the Format property to
Short Date (or similar) so Access understands the data type.

Explanation of why in this article:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top