Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Aug 2008
    Location
    Daytona Beach, Florida, USA
    Posts
    42
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Convert from month number to month name

    I am trying to convert the month number say 10 for October to October on a report. I am using "mmmm" in the format for the text box, but it keeps giving me Jan.

    PLEASE HELP!!!

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,435
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Brandy,

    Could you post a screen shot of the Textbox format entry?
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Lounger
    Join Date
    Aug 2008
    Location
    Daytona Beach, Florida, USA
    Posts
    42
    Thanks
    3
    Thanked 0 Times in 0 Posts
    See attached
    Attached Files Attached Files

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,435
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Brandy,

    If I read your attachment correctly your field is named Month? Is this field a Date field? I would assume not and you can't use the "mmmm" date format on a normal number type field. You will have to create a short UserDefined Function or create a lookup table to convert a regular number into text along the lines of...
    Code:
    Public Function zMonthName(iMonth as integer) as String
    
        Select Case iMonth
           Case 1: zMonthName =  "January"
           Case 2: zMonthName = "February"
            .
            .
            .
          Case 12: zMonthName ="December"
          Case Else: zMonthName = "Invalid Month Number"
        End Select
    End Function  'zMonthName
    Then setup an unbound field that calls the function with the current record value of month. :cheers
    P.S. There is probably a more efficient way to code this but it will get the job done.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    As RG has said that month is a field holding a value of 1 to 12, you could try the following:

    =Format(DateSerial(11, [Month], 1),"mmmm")

    Where 11 is a Year and 1 is a Day, these are just used so that DateSerial can be used.

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    There is actually a MonthName function that converts a number to a Month Name.

    MonthName(3) returns March
    MonthName(3,true ) returns Mar
    MonthName(7,false) returns July

    Regards
    John



  7. #7
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,435
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    John & Phatt,

    My education continues...thanks to both of you.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •