SPECIFYING DATE RANGE IN A QUERY

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All.
I am designing a query in MS Access and need to create a quarterly report.
When I use the expression Between '01/01/2005' AND '04/01/2005' I get all the
records! Syntax is correct as per ANSI-92??
 
HELP said:
Hello All.
I am designing a query in MS Access and need to create a quarterly
report. When I use the expression Between '01/01/2005' AND
'04/01/2005' I get all the records! Syntax is correct as per
ANSI-92??

So who says Access is compliant with ANSI 92?
In Access dates are delimited with #. You're also better off using
yyyy-mm-dd formatting for your date literals within the query.
 
The right syntax for date will be, to put the # symbol before and after the
date
Between #01/01/2005# AND #04/01/2005#
that incase you trying to filter on a date field
 
Thanks Ofer, this helped in the end!

Ofer said:
The right syntax for date will be, to put the # symbol before and after the
date
Between #01/01/2005# AND #04/01/2005#
that incase you trying to filter on a date field
 
Back
Top