Sorting and Grouping many different ways - same report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have reports that the users want to be able to sort and group in many different ways. Obviously, I would rather just create one report and handle the sorting and grouping in code. Is this possible?
My immediate need is for a highlevel sort and group, then a second level sort which will be either ascending or descending.
 
David said:
I have reports that the users want to be able to sort and group in many different ways. Obviously, I would rather just create one report and handle the sorting and grouping in code. Is this possible?
My immediate need is for a highlevel sort and group, then a second level sort which will be either ascending or descending.


You can set the report's GroupLevel properties (see Help for
specifics) in the report's Open event. For example:

Me.GroupLevel(0).ControlSource = Forms!someform.combo1
Me.GroupLevel(1).ControlSource = Forms!someform.combo2
Me.GroupLevel(1).SortOrder = True 'Descending

There's more to do if you have group headers/footers that
refer to the grouping field. Post back with the details if
you have an issue like this.
 
Note that unless you need the subtotals, you don't need separate group
levels for each group field.

You can use a calculated value for the group field: [branch] & [city] &
[action]

This allows you to group by multiple fields without changing the number of
group levels.

(david)

David said:
I have reports that the users want to be able to sort and group in many
different ways. Obviously, I would rather just create one report and handle
the sorting and grouping in code. Is this possible?
My immediate need is for a highlevel sort and group, then a second level
sort which will be either ascending or descending.
 
Yes, use the GroupOn property in an Open Event Procedure.
You'll need a form that has buttons that opens the form
with each button representing the buttons. i.e.

Me.GroupLevel(0).GroupOn = 4

Here Me. refers to the instant report, Grouplevel is the
order of the group and GroupOn = 4 refers to the available
grouping option for the data type. For instance, if the
data type is a date field then the groupon = 4 would group
by month. Check out the Visual Basic help searching
by "GroupOn Property" to see the options for each data
type.

-----Original Message-----
I have reports that the users want to be able to sort and
group in many different ways. Obviously, I would rather
just create one report and handle the sorting and grouping
in code. Is this possible?
My immediate need is for a highlevel sort and group, then
a second level sort which will be either ascending or
descending.
 
Back
Top