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

All dates older than 6 months from today

Status
Not open for further replies.

pavNell

Technical User
Sep 27, 2002
178
US
Needing to query my "date_last_used" field for records older than 6 months from todays date.

I tried DateAdd('m',-6,Date()) but it no workee and I'm not very Access smart.

Thanks for any help.
 
DateAdd("m",-1,Date()) should calculate correctly. Are you getting an error message?

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
DateAdd("m",-1,Date()) returns only the records for December 7, 2004(exactly 1 month ago to the date). Likewise, DateAdd("m",-3,Date()) returns records for October 7, 2004 only. I'm looking for all records older than 6 months from todays date.

i.e.
if todays date is 1/7/05
then I want "all" records older than 7/7/05.

Thanks.

 
Code:
Where [DateField] [b][COLOR=red]<=[/color][/b] DateAdd ( "m", 6, Date() )
 
I thought you were looking for all records more than six months old. Hence your -6 in the DateAdd function.
To get all dates Prior to six months in the future from today's date, change your -6 to 6.

DateAdd("m",6,Date())

I am what I am based on the decisions I have made.

DoubleD [bigcheeks]
 
DoubleD,

Your right, my dumb.

if todays date is 1/7/05
then I want "all" records older than 7/7/04.

But like I said, DateAdd("m",-1,Date()) returns only the records for December 7, 2004(exactly 1 month ago to the date).



 
Never mind, Golom set me straight. In my criteria box I put, <=DateAdd("m",-6,Date())

Thanks all!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top