Can't get query to return today's record

See attached.  Why won't the query return today's record?
Query-Example.accdb
SteveL13Asked:
Who is Participating?
 
Wilder1626Connect With a Mentor Commented:
Hi

This should also work

SELECT tblRecords.ID, tblRecords.RecordDate
FROM tblRecords
WHERE (((tblRecords.RecordDate)>=Date())) and (((tblRecords.RecordDate)<=Date()+1));

Open in new window

0
 
Gustav BrockCIOCommented:
That's because your dates include time. So have the expression DateValue(RecordedDate]) and filter on that, or ensure that clean dates without a time part are entered.

/gustav
0
 
PatHartmanConnect With a Mentor Commented:
The second part of Wilder's suggestion needs to be just < rather than <=.  You don't want midnight tomorrow to satisfy the criteria.
0
 
Gustav BrockCIOCommented:
That would include dates of next day at Midnight as well.
But you could use:

WHERE tblRecords.RecordDate Between Date() And Date() + #23:59:59#;

or

WHERE (((tblRecords.RecordDate)>=Date())) and (((tblRecords.RecordDate)<Date()+1));

/gustav
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.