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

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).
 
D

David F

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?
 
D

David F

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).
 

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