User controlled sorting and grouping?

M

mscertified

I have several reports where I want to allow the user to specify the sorting
and grouping columns at the time the report is requested.
In other words, each time the report is run it may need to print in a
different sequence.
How do I set that up in the report?
Thanks.
 
M

Marshall Barton

mscertified said:
I have several reports where I want to allow the user to specify the sorting
and grouping columns at the time the report is requested.
In other words, each time the report is run it may need to print in a
different sequence.
How do I set that up in the report?


First make sure that you have all the sorting/grouping
levels you need in the report. Then use code in the
report's Open event to modify them

Me.GroupLevel(0).ControlSource = "firstsortfield"
Me.GroupLevel(1).ControlSource = "secondsortfield"

If you want to "disable" a sort /group level, set its
control source to a constant expression
Me.GroupLevel(x).ControlSource = "=1"
If the group has a header/footer section, make it invisible
Me.Section(n).Visible = False
 
Top