Show data if more than one record in group

J

jcade4

I need for my report to list data only if there is more than one record in a
group. Please help!
 
K

KARL DEWEY

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.
 
A

Adnan

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
 
M

Marshall Barton

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)
 

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