Reset Original Group Levels and SortOrder

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

Marshall Barton

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.
 

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