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!

Is there an ACCESS equivelant to VFP's GOMONTH?? 1

Status
Not open for further replies.

TeresePamela

Programmer
Sep 4, 2003
40
US
I need to be able to manipulate dates in the following way:
Add x number of months to a given date and have the results precise enough that if I add 3months to 30-Nov-2003, the result is 29-Feb-2004, If I add 3 months to 30-Nov-2002, the result is 28-Feb-2003. Also if I add 30 days to 28-Feb-3004, the result is 29-Mar-2004 and adding 30 days to 28-Feb-2002 would result in 30-Mar-2002.

This would be done background, probably from a button in a form; (in VFP I would run it in a program by simply stating: newdate = GOMONTH(today, 3), but VFP is being phased out of the company).

I am using Access 2000 running on Windows 2000.

Thanks in advance for any and all help.
 
Hi!

Have you tried the dateadd function?

It should give the desired results, using months as intervall, but I'm not sure how it works with days, I think that's count of days. Sample:

[tt]dtMyNewDate=dateadd("m",3,date)[/tt]

More info on the arguements in the help files.

Roy-Vidar
 
Thanks Roy-Vidar,

You cannot imagine how helpful this was. I had seen the command, but for some reason didn't think it would do what I wanted - it's PERFECT, catches leap-years, adds days also.

Thanks so much - now I can move on :)

Pam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top