How can I specify a sort order when opening a report from a form?

  • Thread starter Thread starter Allen Browne
  • Start date Start date
A

Allen Browne

The sort order for a report is defined in its Sorting'n'Grouping box, not in
the ORDER BY clause of its RecordSource.

If you want to dynamically change the sorting when you open the report, you
can reassign the ControlSource of the GroupLevel in its Open event. Example
at:
http://allenbrowne.com/ser-33.html


If there is nothing inthe Sorting'n'Grouping box, you could set the OrderBy
property of the report (remembering to set OrderByOn to True as well).
 
How can I specify a sort order when opening a report from a form?

I probably could use the "FilterName" rather than the "WhereCondition" of
the OpenReport Method. But the record source for the report is a rather
complex query.

Is there an easy way to specify a sort order when opening a report from a
form?
 
Great reference.

Thank you.



Allen Browne said:
The sort order for a report is defined in its Sorting'n'Grouping box, not in
the ORDER BY clause of its RecordSource.

If you want to dynamically change the sorting when you open the report, you
can reassign the ControlSource of the GroupLevel in its Open event. Example
at:
http://allenbrowne.com/ser-33.html


If there is nothing inthe Sorting'n'Grouping box, you could set the OrderBy
property of the report (remembering to set OrderByOn to True as well).
 
Back
Top