date field find today

travismp

Registered User.
Local time
Today, 18:16
Joined
Oct 15, 2001
Messages
386
I have a date/time format field.

"8/21/2007 10:02:34 PM" is what my column shows.

What would I add to the criteria to the query to find all records added today?

at the end of the day my user needs to run a query that will show everything from today. Thanks.
 
In query SQL View, add the Where Clause:-

SELECT ......
FROM .......
WHERE DateValue([dateTimeFieldName])=Date()
.
 
thanks all

got it... thanks all

Like Date() & "*"
 
is it better to do it your way or the way I figured out?
 
Like is better.

As Like is supposed to work properly only on text fields, it's surprising it can work on a date/time field and can do it relatively faster than DateValue() on a large table.
.
 
Last edited:
Both DateValue() and Like cannot make use of indexes.

If the table is large, the best way would be to store the date and time in two fields and index the date field, for then the query can take advantage of the index and should run with lightning speed.

^
 

Users who are viewing this thread

Back
Top Bottom