How can I hide Subreport if only one recored in it

A

Andrew

I have a report which lists property sales. This report has a linked
subreport that is designed to show if the property has a prior or more
recent sale.

I ran into problems using a query to first group together properties with
multiple sales (long story), now I am trying to let just the report do the
work for me.

What I need is some way to hide the subreport if it only contains the 1
record (as this will just be the original sale) but display the subreport if
it has multiple records.

I tried the following

If Me.RPDSubReport.Report.Count > 1 Then
Me.RPDSubReport.Report.Visible = True
Else
Me.RPDSubReport.Report.Visible = False
End If

in the On Format Event of the Detail Section for each sale, but it does not
seem to do anything?

Any help or a different approach would be most appreciated.

Thanks Andrew.
 
M

Marshall Barton

Andrew said:
I have a report which lists property sales. This report has a linked
subreport that is designed to show if the property has a prior or more
recent sale.

I ran into problems using a query to first group together properties with
multiple sales (long story), now I am trying to let just the report do the
work for me.

What I need is some way to hide the subreport if it only contains the 1
record (as this will just be the original sale) but display the subreport if
it has multiple records.

I tried the following

If Me.RPDSubReport.Report.Count > 1 Then
Me.RPDSubReport.Report.Visible = True
Else
Me.RPDSubReport.Report.Visible = False
End If

in the On Format Event of the Detail Section for each sale, but it does not
seem to do anything?


Place a text box named txtDetailCount in the subreport's
Report Header section and set its expression to =Count(*)

Then use this in the main report detail section's Format
event:

Me.RPDSubReport.Visible = _
(Me.RPDSubReport.Report.txtDetailCount > 1)
 
A

Andy

Thanks Marshall,

Sorry for the delay in thanking you, was dragged away from my computer

Andrew
 

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