Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting and grouping a report through code

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
I have a field in my report called "Srt". I would like to have this field sometimes sorted in ascending order and sometimes in descending order based on users choice. The default is in ascending order.

The Sorting and grouping in the report looks like this:

Grp1 | Ascending ===> This field is grouped
Srt | Ascending ===> Not grouped

How can I change it to descending order

I tried this code but I could not get it to work.

Code:
Reports("Summary Report").Controls!Srt.SortOrder = True

I get this error message

object doesn't support this property or method.

Thanks in advance for your help!!
 
Is there anyway to have something sorted even though it is not grouped?
 
I figured it out regardless if the "Srt" is grouped or not you still refer to it as a group. If it is on the second line/group you would code it as follows.

Code:
Reports("Summary Report").GroupLevel(1).SortOrder = True

1st line is .GroupLevel(0)
2nd line is .GroupLevel(1)
3rd line is .GroupLevel(2)

Thanks, and I hope it helps someone else in the future!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top