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!

Convert numerical month to it's text equivalent 3

Status
Not open for further replies.

Trogg

IS-IT--Management
Feb 13, 2003
80
0
0
US
After using Datepart on a date field to isolate the month is there a function or simple way to display the number's text equivalent?(Ie. 7 is "July" or 1 is "January")

Thanks in advance!
 
I don't think so unless you want to write your own function that uses Select Case to conditionally return it.

Althought a better solution is to just use the format function to get what you want...


Format (<Date>, "mmmm")


Where <Date> is the date you want to display the month for.
 

Trogg,

lameid assumes that you still have that date in your table, that the month was isolated. If not then

Format("2007-" & yourMonthField & "-01", "mmmm")
 
Trogg,

You can use the MonthName() function. It takes the month as Long and returns the full name of the month.

[tt]MonthName(8) returns August[/tt]

The function has an optional second argument that allows you to get the month's abbreviation:

[tt]MonthName(9) returns Sep[/tt]

HTH,
Larry
 
Awesome Jerry!... Here is what i wound up with...

=Format("2007-" & [Enter the number of the month desired] & "-01","mmmm")

Works like a charm in my report!

Double Cudos to you!
 
Just tried Larry's too!

=MonthName([Enter the number of the month desired])

Simpler and works too! I was not aware of the MonthName function. Thanks Larry! 2 solutions both work... stars to you both.
 
Have a star Larry... That one snuck by me.

I thought Trogg had the original date because he said he had used month to get the value. Oh, well. If I had suspected that I would have recommended using Dateserial rather than letting Access do an implicit conversion to date as JerryKlms posted but clearly monthname is the way to go.
 
Thanks lameid! I picked up that function many, many years ago in one of those email tips. I'm surprised I still remember it because I've rarely used it.

- Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top