query with date ciriteria..

N

nycdon

have a simple select query to select rows by date entered..have data rows for
3/15/07. When use criteria of <=3/15/07 (or even =3/15/07!), I dont get
returned rows. If change to <3/16/07 I get the 3/15 rows...never saw this
before..

any ideas?
thx
 
N

nycdon

Thanks Marsh! Date was valued using Now(), so used Datevalue against it in
query to only compare date part and works.

Marshall Barton said:
nycdon said:
have a simple select query to select rows by date entered..have data rows for
3/15/07. When use criteria of <=3/15/07 (or even =3/15/07!), I dont get
returned rows. If change to <3/16/07 I get the 3/15 rows...never saw this
before..


Please use Copy/Paste to post the relevant parts (all?) of
your query's SQL view. This way would won't waste time
debugging your posting generalizations and typos.

You need to use # signs around any literal date.

If your date field was set by using the Now() function, it
will contain a time part, which is after midnight (which is
used when you do not specify the time). This explains why
the #3/16/07# works.

The typical workarounds are either to add 1 to the criteria:

WHERE datefield <= [Enter End Date] + 1
Or
WHERE DateValue(datefield) <= [Enter End Date]
 
M

Marshall Barton

nycdon said:
have a simple select query to select rows by date entered..have data rows for
3/15/07. When use criteria of <=3/15/07 (or even =3/15/07!), I dont get
returned rows. If change to <3/16/07 I get the 3/15 rows...never saw this
before..


Please use Copy/Paste to post the relevant parts (all?) of
your query's SQL view. This way would won't waste time
debugging your posting generalizations and typos.

You need to use # signs around any literal date.

If your date field was set by using the Now() function, it
will contain a time part, which is after midnight (which is
used when you do not specify the time). This explains why
the #3/16/07# works.

The typical workarounds are either to add 1 to the criteria:

WHERE datefield <= [Enter End Date] + 1
Or
WHERE DateValue(datefield) <= [Enter End Date]
 
Top