none
Hide subreport if no data RRS feed

  • Question

  • Hi,

    I have a sub report I want to hide when no data. It works in other reports but I must be doing something odd.

    In the On_format event of the details section which contains two sub reports, I have this code.

    
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    
    ' ---------------
    ' dont show open investigations subreport and show LabelNoneOpen label if subreport has no data
    ' ---------------
    ' Open Investigations Subform code
    If Not Me!subrptOpen.Report.HasData Then
    Me.LabelNoneOpen.Visible = True
    
    Else
    Me.LabelNoneOpen.Visible = False
    
    
    End If
    ' ---------------
    
    
    ' ---------------
    ' dont show open investigations subreport and show LabelNoneOpen label if subreport has no data
    ' ---------------
    ' Open Investigations Subform code
    If Not Me!subrptClosed.Report.HasData Then
    Me.LabelNoneClosed.Visible = True
    
    Else
    Me.LabelNoneClosed.Visible = False
    
    End If
    ' ---------------
    
    
    
    
    
    
    End Sub

    But the subreport keeps rendering like the above image with no data. I am confused. Any help would be appreciated.

    Thanks John


    JG

    Thursday, October 11, 2018 5:50 AM

Answers