Date() or (Date())-1

OZmc

Registered User.
Local time
Today, 09:20
Joined
Dec 14, 2012
Messages
27
this is a weird one.
I have a form that inputs a short date into the target table on load.
now I want to make a query that returns all records made today or yesterday.
I am using a query that looks in the date_record field: the total field is "where" and the criteria is Date() Or (Date())-1

Whats odd is (Date())-1 works but the simple Date() doesn’t return any values.
 
A "Short Date" is setting you can use with the Format function to display a date. A date is not stored as a "Short Date."

And you're saying you OR dates together? Like this?
Code:
WHERE Date() Or Date() - 1
... or do you have a field in there?
Code:
WHERE MyDateField = Date() Or Date() - 1
Do you see that probably neither of those are what you mean to do. Consider ...
Code:
WHERE MyDateField >= Date() - 1 AND MyDateField <= Date()
... or at a minimum ...
Code:
WHERE MyDateField = Date() - 1 OR MyDateField = Date()
Hope this helps,
 

Users who are viewing this thread

Back
Top Bottom