Remove Report Groups At Runtime

  • Thread starter Thread starter Eli
  • Start date Start date
E

Eli

Does anyone know if a Report Group can be removed programatically at
runtime?

I know we can use the CreateGroupLevel method in VBA to add groups, but is
there a method than can remove groups?

Thanks in advance.
 
Eli said:
Does anyone know if a Report Group can be removed programatically at
runtime?

I know we can use the CreateGroupLevel method in VBA to add groups, but is
there a method than can remove groups?


You can only use CreateGroupLevel at Design time. This
function is only useful if you're creating a report
generation wizard.

There is no way to remove a group level using VBA at any
time. The only way to delete a group level is by using the
UI.

OTOH, it's not really necessary to delete a group level.
You can effectivly "disable" a group level by using code in
the report's Open event procedure:

Me.GroupLevel(x).ControlSource = "=1"
and by making it's header/footer invisible:
Me.Section(n),Visible = False
 
Hi Marsh,

Thanks VERY much for the help. It worked perfectly. I was already making
the section invisible, but it was still grouping the records, and I didn't
think of faking it out like you suggested.

Just wondering about one thing though; you placed "=1" after the equal sign
for the controlsource.

Did you mean to place that equal sign along with the number one, or does
that not matter?

I tried it with and without, and I got the same results.

Thanks again.
 
Eli said:
Thanks VERY much for the help. It worked perfectly. I was already making
the section invisible, but it was still grouping the records, and I didn't
think of faking it out like you suggested.

Just wondering about one thing though; you placed "=1" after the equal sign
for the controlsource.

Did you mean to place that equal sign along with the number one, or does
that not matter?

I tried it with and without, and I got the same results.


I won't try to guess whether that's the same thing or not.
The general rule for the ControlSource property is either a
record source field name or an expression preceeded by an =
sign. Since undocumented behavior might change from bersion
to version, figuring out what Access does when you violate
its rules is something I do not want not to get involved
with (unless it's really important).

As you probably already understand, the 1 could just as well
be any constant value. Even this will do the same thing
... = "='Disable Group'"
 
Loud and Clear.

I did realize that the 1 could have been anything at all, just wasn't sure
about the equal sign, so I will do as you suggested. In fact, I will use
"='Disable Group'" so that it's obvious when reading the code.

Thanks agian very much for all your help.
 
Back
Top