Reset Original Group Levels and SortOrder

  • Thread starter Thread starter Sue
  • Start date Start date
S

Sue

Hi All.

I am allowing users to filter and sort anyway they wish
for a given report. Once the report is closed, I am
resetting the GroupLevel back to the original default
order. I cannot seem to figure out how to reset the
GroupLevel SortOrder. So when I open the report in
design view and choose Sorting and grouping I see the
default GroupLevel(s) only but there are additional
Ascending's and Descending's going down the grid for as
many sorts as the user used. Then I get an error trying
to run the report straight because of this.

If there is a CreateGroupLevel Function, what does one do
to Delete a GroupLevel? I can clear the GroupLevel
itself by:

Reports(sTheReport).GroupLevel(j).ControlSource = ""

but since SortOrder is a boolean, True being ASC and
False being DESC, I am stuck.

Any ideas?
 
Sue said:
I am allowing users to filter and sort anyway they wish
for a given report. Once the report is closed, I am
resetting the GroupLevel back to the original default
order. I cannot seem to figure out how to reset the
GroupLevel SortOrder. So when I open the report in
design view and choose Sorting and grouping I see the
default GroupLevel(s) only but there are additional
Ascending's and Descending's going down the grid for as
many sorts as the user used. Then I get an error trying
to run the report straight because of this.

If there is a CreateGroupLevel Function, what does one do
to Delete a GroupLevel? I can clear the GroupLevel
itself by:

Reports(sTheReport).GroupLevel(j).ControlSource = ""

but since SortOrder is a boolean, True being ASC and
False being DESC, I am stuck.


You're stuck because you should not be using
CreateGroupLevel, it's only there for use by Wizards. (And
there is no DeleteGroupLevel.)

You should manually create the group levels at design time
and then change their properties at run time using code in
the report's Open event. You can effectively "disable" a
sort/group by setting its ControlSource to a constant such
as ="" or =1 (and making the corresponding header/footer
invisible).

This will not affect the report's design so you do not have
to worry about resetting anything.
 
Back
Top