Hide sub report if empty

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rhys Gottwald
    New Member
    • Nov 2010
    • 4

    #1

    Hide sub report if empty

    Hi All,

    I have a subreport that is going to be empty for some lines, so I want it to be hidden it on those lines.

    I have set the the report and page header to not visibel, set the can grow and can shrink to yes, and set the height to 0, and that works.

    But I want to show the lables for the data in the report header. As soon as I do this the report show's on each line.

    I have even tried in the Detail_Format is
    Code:
        If Me.rpt_FishCaught.Report.HasData Then
            Me.rpt_FishCaught.Visible = True
        Else
            Me.rpt_FishCaught.Visible = False
        End If
    But it does not work. Any suggestions?

    Thanx
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    I would put the code in the Report_Open() procedure :
    Code:
    Private Sub Report_Open(Cancel As Integer)
        Me.Parent.rpt_FishCaught.Visible = (Not Me.HasData)
    End Sub

    Comment

    • Rhys Gottwald
      New Member
      • Nov 2010
      • 4

      #3
      Hi NeoPa,

      I put it in the Report_Open proc of the rpt_FishCaught and everthing is visibel, if I remove teh Not, then evey thing is hidden.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        "every thing" means what in this case? Are we talking about rpt_FishCaught (As that is the single item we are attempting to affect)?

        Comment

        Working...