How can you filter a [data + time] field by just date? (1 Viewer)

stell

Registered User.
Local time
Today, 02:27
Joined
Jun 14, 2017
Messages
15
So basically, I set up a macro using the now() function on a form. Now I want to write a query that filters those records by date. I can't quite figure it out because the field has both data AND time and when I set the criteria to =date() it gives me no results.

Any advice would be appreciated!
 

plog

Banishment Pending
Local time
Today, 04:27
Joined
May 11, 2011
Messages
11,638
Wrap your date/time field in DateValue()


DateValue([DateTimeFieldName])
 

stell

Registered User.
Local time
Today, 02:27
Joined
Jun 14, 2017
Messages
15
Perfect! Thank you
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:27
Joined
Jan 20, 2009
Messages
12,851
This will perform vastly better than applying a function to every value in the table:
Code:
WHERE [DateTimeField] >=Date() AND [DateTimeField] < Date() + 1
 

Users who are viewing this thread

Top Bottom