travismp
08-21-2007, 07:20 PM
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.
Jon K
08-21-2007, 07:50 PM
In query SQL View, add the Where Clause:-
SELECT ......
FROM .......
WHERE DateValue([dateTimeFieldName])=Date()
.
travismp
08-21-2007, 07:55 PM
got it... thanks all
Like Date() & "*"
travismp
08-21-2007, 07:55 PM
is it better to do it your way or the way I figured out?
Jon K
08-21-2007, 08:52 PM
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.
.
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.
^