Programatically delete report group levels

E

ExcelMan

I am creating an application with reports that have both default sorting and
the option for the user to customize the report sort order to 3 levels.
Sometimes though the user only selects a single sort level, but the default
sort level may have been more than one. So I need to delete the 2 - n sort
levels the user chose not to use.

As you might guess, I implement the custom sort in the report_open event.
Is there a way for me to delete an unneeded group level? I tried setting
the ControlSource = "", but it didn't like that.

I can't seem to find a GroupLevel(n).Delete method? Any ideas?

Thanks.
 
M

Marshall Barton

ExcelMan said:
I am creating an application with reports that have both default sorting and
the option for the user to customize the report sort order to 3 levels.
Sometimes though the user only selects a single sort level, but the default
sort level may have been more than one. So I need to delete the 2 - n sort
levels the user chose not to use.

As you might guess, I implement the custom sort in the report_open event.
Is there a way for me to delete an unneeded group level? I tried setting
the ControlSource = "", but it didn't like that.

I can't seem to find a GroupLevel(n).Delete method? Any ideas?


Right, there is no method to delete a GroupLevel.
Inconsistent, but there it is.

You were close in trying to set the ControlSource to
something, but you need to use an expression with a constant
value. E.g.
Me.GroupLevel(n).ControlSource = "=1"
 

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