MonthName function (1 Viewer)

mh123

Registered User.
Local time
Today, 02:12
Joined
Feb 26, 2014
Messages
64
Hi

A small puzzle I am hoping someone can help with, a field in my query needs to just show the month name of the date value so I have
Month: MonthName([Field Here]), False] which I believe should give me a non abbreviated month name in my field. When I view my query it returns #Func!
If I use Month: Month([Field Here]) it returns the correct value, but I would like it to show the month name rather then the number.

Any one can offer some guidance?

Thanks
 

mh123

Registered User.
Local time
Today, 02:12
Joined
Feb 26, 2014
Messages
64
Ah, figured it out
EventMonth: MonthName((Month([Field Here])))
Feel free to delete thread if necessary mods sorry to waste space/time!!
 

pr2-eugin

Super Moderator
Local time
Today, 02:12
Joined
Nov 30, 2011
Messages
8,494
The MonthName function takes in the Month Number as argument, not the Date. So try,
Code:
MonthName(Month(FieldName), False)
 

namliam

The Mailman - AWF VIP
Local time
Today, 03:12
Joined
Aug 11, 2003
Messages
11,695
Why use monthname at all? Format(Yourdate, "MMM") or MMMM does the same?
 

Isskint

Slowly Developing
Local time
Today, 02:12
Joined
Apr 25, 2012
Messages
1,302
namliam

that would only display it as a month name. If you need the value to be the name (string) then you use MonthName()
 

namliam

The Mailman - AWF VIP
Local time
Today, 03:12
Joined
Aug 11, 2003
Messages
11,695
Format(Date, "MMMM") is exactly the same as Monthname(month(date))

Only difference you use one function instead of two
 

pr2-eugin

Super Moderator
Local time
Today, 02:12
Joined
Nov 30, 2011
Messages
8,494
Isskint, namliam is right Format is a simpler method over MonthName. As a matter of fact the return type of Format is still a String.
 

Isskint

Slowly Developing
Local time
Today, 02:12
Joined
Apr 25, 2012
Messages
1,302
Isskint, namliam is right Format is a simpler method over MonthName. As a matter of fact the return type of Format is still a String.
Paul,
True it is a simpler method and that is what the OP should use in that scenario. Also true is that Format(Date, "MMMM") is exactly the same as Monthname(month(date)) but Format(expression, "MMMM") is not the same as Monthname(month). I thought it important to acknowledge the difference between the two functions.
MonthName is best suited to identifying the name of a month, where the expression has been entered as a number 1 - 12.
Format() is best suited where a full date (or Long variable) is entered as the expression.
MonthName(4) would give you April but Format(4,"mmmm") would give you January.
 

namliam

The Mailman - AWF VIP
Local time
Today, 03:12
Joined
Aug 11, 2003
Messages
11,695
Obviously, however, a month only rarely should be stored as 1,2,3,4... shouldnt it? assuming a more or less proper design offcourse....
 

mh123

Registered User.
Local time
Today, 02:12
Joined
Feb 26, 2014
Messages
64
Thanks for the comments, the Format way definitely looks simpler which is good to know it does the same thing for a standard date field - will definitely use that going forward I think :)!
 

Users who are viewing this thread

Top Bottom