Change Grouping/Sort Order Report

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi Folks - Currently, I have a report that displays legal cases by Attorney.
Besides other fields, the report displays the client's last name, and a
deadline date. It is grouped by Attorney and sorted by client last name.

I'd like to run the same report, but remove the grouping and sort by
deadline date in descending order. I've seen a few posts on this topic, but
not exactly what I am trying to do. Any suggestions?

Thanks,

Michael
 
Michael said:
Hi Folks - Currently, I have a report that displays legal cases by Attorney.
Besides other fields, the report displays the client's last name, and a
deadline date. It is grouped by Attorney and sorted by client last name.

I'd like to run the same report, but remove the grouping and sort by
deadline date in descending order.


Presuming you have a separate buttons on the form to open
the two variations of the report, use code in the report's
Open event to change it to the by date format:

If Me.OpenArgs = "By Date" Then
Me.GroupLevel(0).ControlSource = "=1"
Me.Section(5).Visible = False 'hide group header
Me.Section(5).Visible = False 'and footer
Me.GroupLevel(1).ControlSource = "deadlinefield"
Me.GroupLevel(1).SortOrder = True 'descending
End If

The code for the by date button on the form would be the
same as the regular button, except it would use the OpenArgs
argument on the OpenReport method:

DoCmd.OpenReport . . . ,OpenArgs:="By Date"
 
Back
Top