DateAdd

P

Phoebe.

Hi, Good Day!

Format(DateAdd("m", 11, Mid$(mDate,5,2) + "/" + Right$(mDate,2) + "/" +
Left$(mDate,4)), "dd/mm/yyyy")

The above is part of my formula which to add 11 months to mDate, is there a
way to set the day as the last day for the particular month. For eg.
mDate= 01/01/2003
The new date=01/12/2003
The date that i want it to be show: 31/12/2003

How can it be done since some of the month have 30 days, 29 days and even 28
days.
Can someone help?
Thanks in advanced.

rgds,
Phoebe.
 
S

Steve Schapel

Phoebe,

First of all, your expression to add 11 months is not correct. Is
mDate a Date/Time data type? Or is it a Text field? If it's a date,
for your 11 months you can just use...
DateAdd("m",11,[mDate])
If it's text, you can use...
DateAdd("m",11,CDate([mDate]))

For the last day of the 11th month, try this...
DateSerial(Year([mDate])+1,Month([mDate]),0)

- Steve Schapel, Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

date function 2
DateAdd thought 3
Split values 1
Macro for Dates 5
DateAdd problem 2
Dates swapping 5
Excel date formate doesn't change 0
help with Sum in between dates 12

Top