How to Programatically change a detail report to a group report?

N

nickpup

Is it possible to programatically, from VB, change a detail report to a group
report, ie, do not print the details, just the group totals?

If so, how can this be done?

This is for Access 2002.

Thanks,
Nick
 
A

Allen Browne

In the Open event of the report, set the Visible property of the Detail
section.

This example assumes a form named "MyForm", with a check box named
"chkSummaryOnly":

Private Sub Report_Open(Cancel As Integer)
If CurrentProject.AllForms("MyForm").IsLoaded Then
If Forms("MyForm")!chkSummaryOnly.Value = True Then
Me.Section(acDetail).Visible = False
Else
Me.Section(acDetail).Visible = True
End If
End If
End Sub


Note: Access 97 and earlier do not have the AllForms collection. Copy the
IsLoaded() function from the Utility module in Northwind.
 
Top