How to ask today -one day in access

I need to run a query that looks at a table and chooses what happened the day before. I tried Now()-1 but that does not seem to work
Serena2345Asked:
Who is Participating?
 
James BaileyProject PlannerCommented:
If your field contains date and time information (as produced by the Now() function). You'll have a bit more work, but not hard work. Your where clause will have to allow for a range. Say yesterday is 03/25/2015, The range you'd need might look something like this:
WHERE [DateField] BETWEEN Date()-1 AND dateadd("s",-1,date).

The calculated range is between midnight yesterday and one second before midnight today.
I hope this is helpful.

For a simpler solutionYou might also try:
FORMAT([DateField],"mm/dd/yyyy")=date-1
0
 
Saurabh Singh TeotiaCommented:
Use

=Date()-1

Date() gives you system date and accordingly you can make changes to the same...
Saurabh...
0
 
Rey Obrero (Capricorn1)Commented:
does your DateField include time values?
use this
where [datefield] between date() - 1 and Date()

if not, use this

where [datefield]= date()-1
or

where [datefield]= Dateadd("d",-1,date())
0
 
hnasrCommented:
"I tried Now()-1"
This depends on how you define the day before.

Try: Use Between Operator if time interval exists, as suggested in  Rey's comment.

[yourField] Between Now()-1 AND Now()
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.