Number of Group Levels

F

Fons Ponsioen

You could open ther eport in the design mode and right
click the report bar, and select the Sorting and Grouping
option.
Hope this helps.
Fons
 
D

Dorian Chalom

No, I meant programmatically.

Fons Ponsioen said:
You could open ther eport in the design mode and right
click the report bar, and select the Sorting and Grouping
option.
Hope this helps.
Fons
 
L

Larry Linson

If you will explain what you are trying to accomplish rather than how you
want to accomplish it, perhaps someone could suggest an approach. Just
offhand, I can't think of any reason I'd need to programmatically determine
the number of grouping levels -- that doesn't, of course, mean you don't
have some compelling reason to do so.

Did you want to do this in design view or report view? Please clarify here
in the newsgroup, not by e-mail. Thanks.

Larry Linson
Microsoft Access MVP
 
D

Dorian Chalom

I want to do this to determine if a Group Level Exists. I was hoping to
create a function to go through all the group levels in a given report and
return whether or not a GroupLevel exists or not. If you have a better way
to determine if a group level exist for any given report I would be most
interested.

I want to do this in report view.

I have a series of reports that are simular in design and most all the
reports have the same Group Levels but a couple do not and it is for those
few that do not that I want to detect if the group level exists or not. So I
can avoid trying to work with the Group Levels.

I hope you have a clearer understanding and are able to help.

Dorian
 
L

Larry Linson

"Dorian Chalom" wrote
I want to do this to determine if
a Group Level Exists. I was hoping
to create a function to go through all
the group levels in a given report and
return whether or not a GroupLevel
exists or not. If you have a better way
to determine if a group level exist for
any given report I would be most
interested.

Hmm. Better way than _what_?
I want to do this in report view.

I have a series of reports that are
simular in design and most all the
reports have the same Group Levels
but a couple do not and it is for those
few that do not that I want to detect
if the group level exists or not. So I
can avoid trying to work with the
Group Levels.

I hope you have a clearer understanding
and are able to help.

No, I really don't understand what you mean by "avoid trying to work with
the Group Levels" but perhaps that isn't important. The non-existent Group
Headers and Group Footers for non-existent Groups in a Report cannot execute
any code, in any case.

There is a GroupLevel property, which is an array, and it, in turn, has
properties. The following code will error out with an error 2464 when it
encounters the first non-existent GroupLevel, which I fielded in the Error
Process and simply displayed a MsgBox, but once you reach the Error Process
and test for Err.Number 2464, you can handle any way you wish.

Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_Proc
Dim lngL As Long
For lngL = 0 To 9
Debug.Print lngL, Me.GroupLevel(lngL).ControlSource
Next lngL
Exit_Proc:
Exit Sub
Err_Proc:
MsgBox "Error " & Err.Number & ": " & Err.Description _
& vbCrLf & "Failed at Level = " & lngL
Resume Exit_Proc
End Sub
 
D

Dorian Chalom

There is no way to detect the end of the GroupLevel array other then error
trapping it?
 

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