query with date ciriteria..

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

Guest

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
 
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]
 
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]
 

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

Back
Top