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
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:
Saurabh Singh TeotiaCommented:


Date() gives you system date and accordingly you can make changes to the same...
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

where [datefield]= Dateadd("d",-1,date())
"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()
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.