Show data if more than one record in group

  • Thread starter Thread starter jcade4
  • Start date Start date
J

jcade4

I need for my report to list data only if there is more than one record in a
group. Please help!
 
Use a query or subquery to count records and then use as criteria to only
pull records if there are more than one in a group.
 
Add a text box named as text on header section with Control Course:
=Count([ID])

Chose Code under View menu and paste the following code

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me!Text > 1 Then
Me.Section(acDetail).Visible = False
Else
Me.Section(acDetail).Visible = True
End If

End Sub

Hope this helps,
Adnan
 
jcade4 said:
I need for my report to list data only if there is more than one record in a
group.


Not very elegant but relatively straightforward. Add a text
box (named txtGrpCnt) to the group header section and set
it's control source expression to =Count(*)

Then add code to the group header section's Format event.
Assuming the group has both a header and footer:

Me.Section(5).Visible = (txtGrpCnt > 1)
Me.Section(0).Visible = (txtGrpCnt > 1)
Me.Section(6).Visible = (txtGrpCnt > 1)
 
Back
Top