none
Format(MonthName([Forms]![Redovisa]![UNIVMONTH]), "MMMM") - Gives me "mars" but I want Mars RRS feed

  • Question

  • Hi

    I save and give files name name like "Values of malt mars 2018" by VBA code. I want the file name to be written with the month name with the first letter in upper case. Not "mars" but "Mars".

    I had this in the line - giving mars:
    MonthName([Forms]![Redovisa]![UNIVMONTH])

    Tried several others like:

    Format(MonthName([Forms]![Redovisa]![UNIVMONTH]), "MMMM")

    Format([Forms]![Redovisa]![UNIVMONTH]), "MMMM")

    Both gives me "mars" but I want Mars.

    Sorry but I cant find the right way .-(


    Best // Peter Forss Stockholm GMT +1.00

    Wednesday, March 14, 2018 3:16 PM

Answers

  • Both Format and MonthName use your system settings; the names of months are written in lower case in Swedish by default. You can use StrConv with 3 as second argument:

    StrConv(MonthName([Forms]![Redovisa]![UNIVMONTH]),3)


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by ForssPeterNova Wednesday, March 14, 2018 3:37 PM
    Wednesday, March 14, 2018 3:30 PM
  • This has to do with your Regional Settings and there respective rules.  You can simply use UCase(Format(...)) or StrConv(Format(...), ...) to get your desired end result but do remember you are going against longstanding defined naming norms for that region.

    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    • Marked as answer by ForssPeterNova Wednesday, March 14, 2018 3:37 PM
    Wednesday, March 14, 2018 3:34 PM

All replies

  • Both Format and MonthName use your system settings; the names of months are written in lower case in Swedish by default. You can use StrConv with 3 as second argument:

    StrConv(MonthName([Forms]![Redovisa]![UNIVMONTH]),3)


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by ForssPeterNova Wednesday, March 14, 2018 3:37 PM
    Wednesday, March 14, 2018 3:30 PM
  • This has to do with your Regional Settings and there respective rules.  You can simply use UCase(Format(...)) or StrConv(Format(...), ...) to get your desired end result but do remember you are going against longstanding defined naming norms for that region.

    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    • Marked as answer by ForssPeterNova Wednesday, March 14, 2018 3:37 PM
    Wednesday, March 14, 2018 3:34 PM
  • Thanks Hans and Daniel!

    Best // Peter Forss Stockholm GMT +1.00

    Wednesday, March 14, 2018 3:38 PM