Report - Does someone know?

  • Thread starter Thread starter Randy Fritz
  • Start date Start date
R

Randy Fritz

Hello NG

I have a production report that has detail information and an employee
header for specific employee information. My Boss periodically asks me to
sort the employees by supervisor or by agency or by agency and supervisor or
by supervisor and agency. Because of this I have kept text boxes hidden in
the detail section for supervisor and agency and when asked when into the
report and modified the sorting and grouping to accomodate his wishes. this
at times is a lot of work. now he wants to add group leaders under
supervisors and team leaders under group leaders. This scares me!! I would
like to create a form for him to be able to choose his sorting criteria and
prioritize it aka sort this first then this second and so on. and then on
the report open aspect code it to take the information from the form and
build headers based off of it. I know how to change the sorting but I need
some suggestions as to how to build the headers.

TIAFAH

Randy
 
You cannot create the header and footer sections on the fly (unless you open
the report in design view).

What you can do is create the number of header/footers you need, and
reassign them or hide them at runtime.

The sections have a PrintSection property as well as a Visible property, so
take your pick.

To group the data by a different field, you can assign the ControlSource of
the GroupLevel. Example:
http://allenbrowne.com/ser-33.html

Using both techniques (hide/show level, and reassign the field of the group
header footer), you can make some incredibly flexible reports. The
technique involves providing combos on a form where the user can select the
field name for GroupLevel(0), GroupLevel(1), etc, and check boxes to hide
the inner grouping header/footers. In the Open event of the report, read the
combos from the form, assign the ControlSource of each GroupLevel, assign
the ControlSource of the text boxes under each column, change the Caption of
the label over the column (assuming you are indenting your layout), and
show/hide the sections.
 
TY Allen

I like your idea. Just 1 more question on this subject. So I set up 7
Group Levels Each with a header/footer. The first four situations your idea
will work well with. These being Agency,Supervisor,Group Lead and Team Lead.
But the Employee Header has code for the OnPrint event - lets say that my
boss doesn't want to see the report anyway except by the employee - I change
the Group Levels from
1) Agency
2) Supervisor
3) Group Lead
4) Team Lead
5) Employee
6) Date
How would I set the Group Levels to do just by the employee and Keep the
header code?

Randy
 
If you have 7 group levels defined, and you want to use only one of them,
set all 7 to the same ControlSource. The lower 6 have no practical effect,
and you hide those sections.

If you have code in the Print event of a section that is not printed,
naturally enough the code will not fire. Not sure what your code is doing,
but it is not a good idea to use this event for anything that spans more
than one page. The Print event of the sections probably will not fire if the
user prints or previews only some later pages of the report (e.g. just page
4, without previewing pages 2 and 3), so anything involving aggregation
across pages is not reliable anyway.
 
Back
Top