Hiding a subreport and the extra white space

G

Guest

I know this has been asked before, but I've tried several things to no avail.
I have a report (aka AllActivities) that lists each team members activities for the week under each team member's name.
This report contains a subreport (e.g. Activities), which itself contains several subreports (Activity1, Activity2, etc.)
If one of the subreports (Activity1 or Activity2) has no data for a particular team member, I want to hide that in the main report and get rid of the extra white space.
Currently, this is what I have in the Activity1 OnFormat event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.KBsReviewed.Report.HasData Then
Me.KBsReviewed.Visible = True
Else
Me.KBsReviewed.Visible = False
End If
End Sub

KBsReviewed is a control in this subreport. If this contol has no data for that team member, then I want to hide this subreport and get rid of the white space.

I get the run-time 2455 error: You entered an expression that has an invalid reference to the property Form/Report.
If this is the correct code to use, how do I fix it.
OR
Is there a better way to do this?
 

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