If Me.pmmonth.Value = 1 Then
Me.pmmonth.Value = "Jan"
ElseIf Me.pmmonth = 2 Then
Me.pmmonth = "Feb"
ElseIf Me.pmmonth = 3 Then
Me.pmmonth = "Mar"
ElseIf Me.pmmonth = 4 Then
Me.pmmonth = "Apr"
ElseIf Me.pmmonth = 5 Then
Me.pmmonth = "May"
ElseIf Me.pmmonth = 6 Then
Me.pmmonth = "Jun"
End If
"Jacob" <jse...@intermed1.com> wrote in message
news:e2s2qlcR...@TK2MSFTNGP06.phx.gbl...
Depending on what the underlying field is (e.g., a date/time field), you
could simply use the Format() function to return the three-character
monthname without saving/storing pmmonth.Value at all!
Good luck
Regards
Jeff Boyce
Microsoft Office/Accesss MVP
"Jacob" <jse...@intermed1.com> wrote in message
news:eYNekncR...@TK2MSFTNGP04.phx.gbl...
=Choose([pmmonth], "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec")
Where [pmmonth] is the name of the report's recordset field.
"Jacob" <jse...@intermed1.com> wrote in message
news:e2s2qlcR...@TK2MSFTNGP06.phx.gbl...
I'll chime in with a third approach, if what you want is to translate a
month number into a month name. You can use the MonthName function. It can
give you either the full name or an abbreviation, depending on an optional
argument. For example,
?MonthName(11)
November
?MonthName(11, true)
Nov
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
"Dirk Goldgar" <d...@NOdataSPAMgnostics.com.invalid> wrote in message
news:ulfJG5nR...@TK2MSFTNGP05.phx.gbl...
<g> There's no end to them! But how come the one I want is never in the
list?
"Dirk Goldgar" <d...@NOdataSPAMgnostics.com.invalid> wrote in message
news:ulfJG5nR...@TK2MSFTNGP05.phx.gbl...
We're always glad to teach. We don't have much information to answer your
question, though. I understand from your posts in this thread that you're
working with a report, and that there is a field named "pmmonth", which is a
month number 1-12. You want to display the (abbreviated) name of the month
on the report instead of the number.
I'm going to guess that you currently have a text box on the report that has
"pmmonth" as its ControlSource property. Quite likely the text box is also
named "pmmonth". We're going to change its ControlSource property, and also
its Name property. Change those properties as follows:
Control Source: =MonthName([pmmonth])
Name: txtPMMonthName
That ought to do it -- you don't have to write any VBA code of your own.
Incidentally, the reason you have to change the name is that it would be
confusing to Access if you had a control named "pmmonth" which wasn't bound
directly to the pmmonth field. There would then be two wholly distinct
things named "pmmonth", and Access would not know which was meant in any
context.
Please let me know if that solves your problem.