Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Previous Day's Date 1

Status
Not open for further replies.

tbohon

Programmer
Apr 20, 2000
293
US
I have an Access database with a date value stored in a table. The user wants to build a query that only pulls records for the previous day. I know how to do this for today's date ... but can't seem to make Access do it for yesterday.

Any thoughts/comments appreciated as always.

Thanks!

Tom

"My mind is like a steel whatchamacallit ...
 
I tried Date()-1 but got a invalid data message. Didn't think about DateAdd ... will see if I can make that work for me.

Thanks, Geoff! Appreciate it!

Tom

"My mind is like a steel whatchamacallit ...
 
Geoff:

Mystery solved! I used Date$() instead of Date() ... a newbie mistake which embarasses me to no end, especially since I was an adjunct faculty member at a local community college teaching Access, etc. for 13 years!

Thanks for the hint - it lead directly to the solution.

Best,

Tom

"My mind is like a steel whatchamacallit ...
 
OK - another problem.

The date field isn't just a date value - it's formatted as a 'general date' which means it has the date and then the time ... and the solution above fails miserably.

While I play around some more would appreciate other less clouded minds than mine considering possible solutions.

Tnx.

Tom

"My mind is like a steel whatchamacallit ...
 
SQL code snippet:
WHERE Int([your date/time field]) = Date() - 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top