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

Need to work out dates that are 16 months in the past.

Status
Not open for further replies.

antihippy

Technical User
Aug 29, 2003
47
0
0
GB
Hi There!

I'm not sure if I am posting this in the right place. I have requirement to add a function that is supposed to look for dates that are 16 months or older in the past. I hate to say this but I cannot get my head round the date functions for this. This is what I tried: DateAdd("m",-16,Now()) but it doesn't work. Am I barking up the wrong tree?
 
The expression looks ok to me.
In what way is it not working?
 
So it's not me then? Its jsut that when I apply it to a set of data (and I know that it contains records more than 16 months old) I get nothing back. And it's the only limit.
 
Ah no. I apologise - there was a typo. oops.
 
Have you tried using
DateAdd("m",-16,Date()) instead of using Now() which includes both date and time instead of just the date.
 
Yes actually. I have been using date. I was using now while I was playihg with it as I there might have been a time requirement. Now that I know that there isn't I've changed it to date(). Thanks anyway.
 
I know this may seem silly...but did you also include the >= before the DateAdd part to specify records with that date and before?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top