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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hamed NasrRetired IT ProfessionalCommented:
"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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.