You can group the report by month and then by employee, and then by category.
Give the employee and month groups group headers, and the category group a
group footer. Put the employee name in the employee header, the month in the
month header and a text box to total the relevant field in the category group
footer. This will five you totals for each employee for each month.
First you'll need a column in the report's underlying recordset to return
the month for the date value in each row. To do this base the report on a
query which returns all the necessary fields from the relevant table(s), and
in query design row out the following in t 'field' row of a blank column:
WorkYearMonth: Format([YourDateField],"yyyymm")
where YourDateField is the name of the field containing the dates. This
will return the month in the format 2000807 (for this month). Its important
that the year is included as otherwise data from the same months in different
years will all be grouped together.
For the month group in the report group on the WorkYearMonth column. To
show the month in a more meaningful format in the group herder add a text box
with a ControlSource property of:
=Format([YourdateField], "mmmm yyyy")
This will show it as July 2008.
To filter the report to a particular month add two more computed columns to
the underlying query by putting the following in the 'field' row of two more
columns in query design view:
WorkYear: Year([YourDateField])
WorkMonth: Month([YourDateField])
These columns won't appear in the report itself, they are purely for
restricting the results to one year/month. To do this enter the following in
the first 'criteria' row of the WorkYear column in query design view:
[Enter year:] Or [Enter Year:] Is Null
and this in the WorkMonth column's first 'criteria' row:
[Enter month as a number 1-12:] Or [Enter month as a number 1-12:] Is Null
You'll find that if you save the query and then open it again in design view
Access will have moved things around. Don't worry, it will work just the
same,
When you open the report you'll be prompted first to enter the year and then
to enter the month. The query's result set, and hence the report will then
be restricted to the year/month entered. By testing each for OR IS NULL this
makes them optional, so if you enter a year but just press Enter at the month
prompt without entering a month the report will be filtered to the whole
year. If you enter neither a year nor a month the report will show all
records unfiltered. In either case the totals will be grouped per
month/employee in the report.
To add a command button to a form for printing the report you can use the
button wizard, but the code for such a button's Click event procedure is in
essence very simple:
DoCmd.OpenReport "YourReportNameGoesHere"
If you also want a button to preview the report its:
DoCmd.OpenReport "YourReportNameGoesHere", View:=acViewPreview
Ken Sheridan
Stafford, England
Dina said:
I have a productivity report that is based on the information I enter into a
form. The report contains information on a staff of five with each staff
having a total at the end of the month in four catagories. The data is
entered by date.
There's a few things I would like for the report to do. I would like to
total the catagories at the end of each month for each staff. I've completed
the month of May and I'm entering the month of June but the calulation is
including the totals from May as well. In other words, June's data is being
added to May's data.
I would like to be able to filter the report by month and print it out with
only the totals for that month. I would also like to have a command button
on the form to print the report. Can anyone give me step by step
instructions? I'm a new user