Query filter criteria

L

Linda

I want a query to show only those records based on today's date. I tried
using =Now() as the criteria, but I get no records even though there is a
record with todays date in the underlying table. I am stymied! Is there
other criteria I should be using?
 
J

Jeff Boyce

Linda

"Now()" specifies the current point in time, down to the hundredths of a
second. Use Now() when you need date and time.

Today's date can be obtained using "Date()" instead.

Regards

Jeff Boyce
<Access MVP>
 
J

Jeff Boyce

Just noticed your follow-on post.

If =Date() doesn't return any records, can you substitute today's date as a
criterion and get records?

Jeff Boyce
<Access MVP>
 
L

Linda

Date() still doesn't return the record. The default for the date field in
the underlying table is Date(). Would that make any difference?
 
L

Linda

SELECT POS.POID, POS.REQUISITIONNUMBER, POS.ORDERDATE, POS.CONTACT, POS.FOB,
POS.DREYNUMBER, POS.INVOICENUMBER, POS.PULLEDBY, POS.STATETAX, POS.LOCALTAX,
POS.FREIGHT, POS.DELIVERVIA, POS.COMPANY, POS.VENDOR, POS.Vcode
FROM POS
WHERE (((POS.ORDERDATE)=Date()));

Here it is, and thanks for trying to assist me. This should be simple, but
I'm pulling my hair out LOL.
 
L

Linda

Putting in today's date doesn't return the record either. I have checked and
re-checked the table. The record is there, and it is a date/time field.
 
L

Linda

I went into the table and re-entered the date and now it seems to be working.
Thanks so much for your assistance. Don't have any idea what the problem
was.
 
L

Linda

As in my post to Jeff, I went in and re-entered the date in the table and now
the query is working. I have no idea why, but please know that appreciate
all the help given to me in this community.
 
J

Jeff Boyce

No idea.

Usually if a query doesn't return rows, the criteria are off, or the data
isn't there. Maybe you were seeing the default Date() in the table, but not
in a row w/ data?

Jeff Boyce
<Access MVP>
 
B

Brendan Reynolds

Perhaps the original data included both a date and a time, but was formatted
to only display the date? For example, if the field contained 02/09/2005
17:33:55 (dd/mm/yyyy format here, swap the day and month if you're in the
US) then it would not match the result of Date(), which is 02/09/2005
00:00:00.
 
L

Linda

Yes, I think that is exactly what happened. The field was originally
formatted with =Now(). I have changed the default to =Date() and that seems
to have cleared it up. Thanks to all who helped with this!
 
Top