Determining Number of Group Levels

  • Thread starter Thread starter AlwaysFroosh!
  • Start date Start date
A

AlwaysFroosh!

I have figured out how to read the different fields that a report is grouping
on by using the following:

Dim BOMReport As Report
Set BOMReport = Reports("My Report")
BOMReport.GroupLevel(0).ControlSource
BOMReport.GroupLevel(1).ControlSource
BOMReport.GroupLevel(2).ControlSource

The reports I'm opening have different numbers of group levels though, and I
need to loop through all of them. Is there a way to dermine how many Group
Levels a report has?

Thanks,
Graham
 
From memory, I don't think there is a Me.Sections.Count, so it's a matter of
trying them and recovering from the error when you get too high.

If you need to know whether a GroupLevel has a group header or footer or
both, test:
Me.Section(5).Name
where 5 is the group level 1 header, 6 is the group level 1 footer and so
on.
 
GroupLevels are not sections. GroupHeaders and GroupFooter are sections.
Unfortunately, there is no Count property for either. The indexes for
sections and grouplevels are both zero based. If you attempt to address a
section greater than the number of sections - 1, the error will be 2462. If
you are addressing grouplevels, it will be 2464.
 
Back
Top