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

date() -2 and -3 questions

Status
Not open for further replies.

patrichek

MIS
Nov 18, 2003
632
US
hi,
how would i format a query to look for records -2,-3 and -4 days ago?

i understand to use date()-2 for records 2 days ago.

thanks!
 
ok, i've figured out that between date()-2 and date()-3 works now i need to add -4 to the mix, help?

thanks!
 
sample data:
myDateField
3/10/2006
3/11/2006
3/12/2006
3/13/2006
3/14/2006

sql:
SELECT Table1.myDateField
FROM Table1
WHERE (((Table1.myDateField)>Date()-5 And (Table1.myDateField)<Date()-1));

output:
myDateField
3/10/2006
3/11/2006
3/12/2006
 
key point:

You want to say "It is greater than five days before today. It is less than yesterday."

That translates to this in the criteria row in query design view:

>Date()-5 And <Date()-1
 
thanks steve,
but i'm embarrased i even posted this! i came up with "between date()-2 and date()-4"


sometimes i scare myself!
 
I don't understand where you're having a problem. If you know that date()-2 and date()-3 work, wouldn't you be tempted to try date()-4?

Perhaps you could expand on what you're trying to accomplish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top