Change Grouping/Sort Order Report

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
 
M

Marshall Barton

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top