Month in title of monthly report

  • Thread starter Thread starter charkey
  • Start date Start date
C

charkey

I am new to Access and have been trying to get the month name show up in the
title of a report. I am using a form for the input of the [Month] and [Year]
as numbers. Then use the form control button to execute a report. This
works great. I then would like to use the input from the form [Month] to put
the name of the month in the title of the report. I put in a text box and
can get it to display the number of the month (ex. 5) but not the name of the
month name (Ex. May). I do not know how to format it to mmmm. I tried an
array:

Dim rmonth
rmonth = Array(“Januaryâ€, “Februaryâ€, “Marchâ€, “Aprilâ€, “Mayâ€, “Juneâ€,
“Julyâ€, “Augustâ€, “Septemberâ€, “Octoberâ€, “Novemberâ€, “Decemberâ€)
rmonth()
I tried to put that in the control source and it did not work. Please help.

Thanks,

Charkey
 
If the form is named Form1, and the month combo is named cboMonth, put an
expression like this into the Control Source of the text box on your report:
=MonthName([Forms]![Form1]![cboMonth])

That should work provided the combo's bound column contains a number between
1 and 12. Use IIf() to avoid the error if it is null.
 
It's easy - Look up MonthName function in Access Help system.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
Thanks for the help! I did a search with the help, online using google and
never found that function. It works great!

Thanks,

Charkey

Allen Browne said:
If the form is named Form1, and the month combo is named cboMonth, put an
expression like this into the Control Source of the text box on your report:
=MonthName([Forms]![Form1]![cboMonth])

That should work provided the combo's bound column contains a number between
1 and 12. Use IIf() to avoid the error if it is null.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.


charkey said:
I am new to Access and have been trying to get the month name show up in
the
title of a report. I am using a form for the input of the [Month] and
[Year]
as numbers. Then use the form control button to execute a report. This
works great. I then would like to use the input from the form [Month] to
put
the name of the month in the title of the report. I put in a text box and
can get it to display the number of the month (ex. 5) but not the name of
the
month name (Ex. May). I do not know how to format it to mmmm. I tried an
array:

Dim rmonth
rmonth = Array(“Januaryâ€, “Februaryâ€, “Marchâ€, “Aprilâ€, “Mayâ€, “Juneâ€,
“Julyâ€, “Augustâ€, “Septemberâ€, “Octoberâ€, “Novemberâ€, “Decemberâ€)
rmonth()
I tried to put that in the control source and it did not work. Please
help.

Thanks,

Charkey

.
 
charkey said:
I am new to Access and have been trying to get the month name show up in the
title of a report. I am using a form for the input of the [Month] and [Year]
as numbers. Then use the form control button to execute a report. This
works great. I then would like to use the input from the form [Month] to put
the name of the month in the title of the report. I put in a text box and
can get it to display the number of the month (ex. 5) but not the name of the
month name (Ex. May). I do not know how to format it to mmmm. I tried an
array:

Since the question's been answered for your specific case, here's an answer for the more
general case when you only have the date rather than the month number:

This will give you the full month name for date.

format(date,"mmmm")

and this will give you the three-letter abbreviation:

format(date,"mmm")

Tom Lake
 
Back
Top