How to calculate month

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

Hi All,

I need to determine a future month. I have to days month and I want to add 5
more months. How would I calculate that in a unbound text box.

I tried =datepart("m",Now())+5 and it gives me 15. I want it to give me the
month name or number. March or 3
 
J

Jeff Boyce

Look in Access HELP for the DateAdd() function...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John W. Vinson

Hi All,

I need to determine a future month. I have to days month and I want to add 5
more months. How would I calculate that in a unbound text box.

I tried =datepart("m",Now())+5 and it gives me 15. I want it to give me the
month name or number. March or 3

DateAdd("m", 5, Date())

will give a Date/Time field five months from today. You can use the format
function or property of a control to display the month name.
 
F

fredg

Hi All,

I need to determine a future month. I have to days month and I want to add 5
more months. How would I calculate that in a unbound text box.

I tried =datepart("m",Now())+5 and it gives me 15. I want it to give me the
month name or number. March or 3

What is your data like?

If you are storing the month's number in a field, i.e. 10 for October,
then:
=IIf([MonthField]<=7,MonthName([MonthField]+5),MonthName(Abs([MonthField]+5-12)))

If you are not storing the month, then:
=IIf(Month(Date())<=7,MonthName(Month(Date())+5),MonthName(Abs(Month(Date())+
5 -12)))
 
M

mattc66 via AccessMonster.com

The month 5 was an example. The number of months to add will very based on
anther textBox.
[quoted text clipped - 3 lines]
I tried =datepart("m",Now())+5 and it gives me 15. I want it to give me the
month name or number. March or 3

What is your data like?

If you are storing the month's number in a field, i.e. 10 for October,
then:
=IIf([MonthField]<=7,MonthName([MonthField]+5),MonthName(Abs([MonthField]+5-12)))

If you are not storing the month, then:
=IIf(Month(Date())<=7,MonthName(Month(Date())+5),MonthName(Abs(Month(Date())+
5 -12)))
 
J

John W. Vinson

The month 5 was an example. The number of months to add will very based on
anther textBox.
[quoted text clipped - 3 lines]
I tried =datepart("m",Now())+5 and it gives me 15. I want it to give me the
month name or number. March or 3

What is your data like?

If you are storing the month's number in a field, i.e. 10 for October,
then:
=IIf([MonthField]<=7,MonthName([MonthField]+5),MonthName(Abs([MonthField]+5-12)))

If you are not storing the month, then:
=IIf(Month(Date())<=7,MonthName(Month(Date())+5),MonthName(Abs(Month(Date())+
5 -12)))

Ok, use Forms!yourformname!textboxname in place of 5.
 
Top