I'm trying to display the next month in a text field

G

gmazza

Hi there,
I've gone through all the forms and can't seem to get the code straight for
displaying the next month on a text field on my form.
I just want the entire month name and nothing else and I have been struggling
with:
DateSerial(Year(Date()), Month(Date()) + 1, 1)

but its showing the day and year too and thats not what I need.
Thanks in advance!
GM
 
G

Guest

You need to look at te Format() function.

Format(YourExpression,"mmm")

That will display your date expression as a full month name.

Steve
 
M

Marshall Barton

gmazza said:
Hi there,
I've gone through all the forms and can't seem to get the code straight for
displaying the next month on a text field on my form.
I just want the entire month name and nothing else and I have been struggling
with:
DateSerial(Year(Date()), Month(Date()) + 1, 1)

but its showing the day and year too and thats not what I need.


MonthName(Month(Date()) + 1)
 
J

John W. Vinson

Hi there,
I've gone through all the forms and can't seem to get the code straight for
displaying the next month on a text field on my form.
I just want the entire month name and nothing else and I have been struggling
with:
DateSerial(Year(Date()), Month(Date()) + 1, 1)

but its showing the day and year too and thats not what I need.
Thanks in advance!
GM

One quick & dirty way is to use this expression and set the Format property of
the textbox to

"mmmm"

John W. Vinson [MVP]
 
G

gmazza via AccessMonster.com

Thanks Steve, that does work, but when I add 1 to it, I get an error.
I just want The current month + 1 to always show up.
You need to look at te Format() function.

Format(YourExpression,"mmm")

That will display your date expression as a full month name.

Steve
Hi there,
I've gone through all the forms and can't seem to get the code straight for
[quoted text clipped - 6 lines]
Thanks in advance!
GM
 
G

gmazza via AccessMonster.com

Thanks Marshall, but its not a specific month I need, I need 1 added to the
current month. Is there a way I can do that with your expression?

Marshall said:
Hi there,
I've gone through all the forms and can't seem to get the code straight for
[quoted text clipped - 4 lines]
but its showing the day and year too and thats not what I need.

MonthName(Month(Date()) + 1)
 
G

gmazza via AccessMonster.com

Good call John, that worked, and you're right, it is a little dirty way to do
it but I'll take it!
Thanks for your help everyone!!
GM
Hi there,
I've gone through all the forms and can't seem to get the code straight for
[quoted text clipped - 6 lines]
Thanks in advance!
GM

One quick & dirty way is to use this expression and set the Format property of
the textbox to

"mmmm"

John W. Vinson [MVP]
 
M

Marshall Barton

One of us is confused ;-)

As far as I can tell, my expression and John's suggestion
are just two different ways of getting the same result.
--
Marsh
MVP [MS Access]

Thanks Marshall, but its not a specific month I need, I need 1 added to the
current month. Is there a way I can do that with your expression?

Marshall said:
Hi there,
I've gone through all the forms and can't seem to get the code straight for
[quoted text clipped - 4 lines]
but its showing the day and year too and thats not what I need.

MonthName(Month(Date()) + 1)
 
J

John W. Vinson

As far as I can tell, my expression and John's suggestion
are just two different ways of getting the same result.

and yours is cleaner... must have been something lost in transition there!

John W. Vinson [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

Top