Sorting a report on the fly

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

I have a form in which users enter in parameter values. I
also want to allow the users to choose what field to sort
a report on.
 
Jim said:
I have a form in which users enter in parameter values. I
also want to allow the users to choose what field to sort
a report on.


How a report is sorted is specified in the report's Sorting
and Grouping window (View menu). First specify the sorting
for a field to create the sort level. Then you can use code
in the report's Open event to change it to the user's
specified field:

If Not IsNull(Froms!theform.cbofields) Then
Me.GroupLevel(0).ControlSource = Froms!theform.cbofields
End If

If the report has grouping specified, change the 0 to the
appropriate index.

Be sure to check Help for details on the GroupLevel
property.
 
Back
Top