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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting data from Yesterday?

Status
Not open for further replies.

Chavito21

Programmer
Mar 26, 2003
230
US
I have a query and I want to tell it to get the information from yesterday. How can I tell it to do date() -1 so I can get yesterday data?
 
It give me this error mesg:
Syntax error (comma in query expression '(((ORDERS.[Date Added])=("d",-1,Date())))'
 
Hi

(((ORDERS.[Date Added])=("d",-1,Date())))'

is not what I said

if this is in an SQL string in code yoe need:

... Orders.WhatEverYourDateColIs = #" & DateAdd("d",-1,date()) & "# ...etc"

if you are not in USA you need to convert the date to US or ANSI format using FORMAT()

... Orders.WhatEverYourDateColIs = #" & Format(DateAdd("d",-1,date()),"yyyy/mm/dd") & "# ...etc"


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Okay I got it, I have a field named Date Added but when I enter on criteria I didn't put the dateAdd which it need to be there. sorry. It's working great thanks for the help.

Chavito
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top