Dynamic group level

S

Souris

I have a multi levels of report and wondering that may I have one report to
have dynamic grouping the report in stead of one report pergroup.


I would like to checking grouping elements value. If the elements have same
value then I do not need this grouping in the report.

Is it possible to be done?
If yes, are there any examples to do so?

Your help is great appreciated,
 
K

Klatuu

You do it in the Report Open event based on selections made on the form from
which the report is opened. Here is an example:

Private Sub Report_Open(Cancel As Integer)

On Error GoTo Report_Open_Error

'Activity is always last
Me.GroupLevel(5).ControlSource = "Activity"
With Forms!frmbporeports
'Determine which Subtotals have been selected
'HomeRooom
If .chkHomeRoom Then
Me.GroupLevel(4).ControlSource = "PerformAcctUnit"
Else
Me.GroupLevel(4).ControlSource = Me.GroupLevel(5).ControlSource
End If
'Pool
If .chkPool Then
Me.GroupLevel(3).ControlSource = "Pool"
Else
Me.GroupLevel(3).ControlSource = Me.GroupLevel(4).ControlSource
End If
'BillNetwork
If .chkBillNetwork Then
Me.GroupLevel(2).ControlSource = "BillNetwork"
Else
Me.GroupLevel(2).ControlSource = Me.GroupLevel(3).ControlSource
End If
'MasterActivity
If .chkMActivity Then
Me.GroupLevel(1).ControlSource = "MActivity"
Else
Me.GroupLevel(1).ControlSource = Me.GroupLevel(2).ControlSource
End If
End With
'Top Level For Billable Product Offering
Me.GroupLevel(0).ControlSource = "ProjectId"

Report_Open_Exit:

On Error Resume Next
Exit Sub

Report_Open_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure Report_Open of VBA Document
Report_rptBPOProducOffering"
GoTo Report_Open_Exit
End Sub
 

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