Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Month automatically print on each group 1

Status
Not open for further replies.

MICKI0220

IS-IT--Management
Jul 20, 2004
337
US
I am looking for a way to have a report automatically put the month and year as the header for each group. I have a report that is based on a query that ask for a specific date range. The report than groups together the dates in each month, however I don't know how to make a group header have a text that takes what the month and year is for that group and put it in the text. Any suggestions.
 
you can use in the text box or more easier in the query add a field like this =format ([yourtable]![yourfield], "mmyyyy")

this should do it correctly

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
Is there a field/column in your report's record source that contains the date value? If so, you can use a text box with a Control Source like:
=MonthName(Month([dateField]))
There are a ton of date functions.

If your date value is coming from a parameter, you can replace the [dateField] with your parameter.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
It isn't one single date. For example, the group may have 10 different entries with all different dates. The only commonality would be that they are in the same month. I want to allow a text box in the header to give me the common month and year.
 
well it should work if you add a field in the query with the format i posted before and group it bu that field

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
I managed to add a field in the query to format the date as the month, however I need the month to now translate into words instead of numbers. for example: The group header now states that JAN is "01" and I need it to convert to say JAN. How can I accomplish this in the report. I have tried to use a case statement and then an "If then" statement but I keep coming up with an error that says. "run-time error '2427' you entered an expression that has no value. This is the test code I am using.

Private Sub Report_Open(Cancel As Integer)

If Me.Month = "01" Then
Me.TXTJULIAN = "jan"
Else
End If
 
You should be able to use a control source something like:
=MonthName(Val([Month]))
No code should be required.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top