Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740

    Unanswered: supress subreport (no data), note which subreports were supressed

    i have a db QC report made up from 25 subreports looking at various parameters
    if there are zero exceptions for a given parameter, the subreport for that parameter is supressed
    ...this was not intentional: Access seems to have decided all by itself to suppress subreports with zero data.
    Q1 how to switch this behaviour on/off?

    supressing empty subreports is reasonably cute so i don't mind it like that, but I then need to add a textbox to the report footer listing all the zero exception reports that were supressed.
    nodata does not work for subreports so i tried hasdata: it turned up False for all reports, including reports with data!
    Q2 what/where is the correct usage of .hasdata so i can build the string for textbox?

    the reports-that-are-subreports work perfectly on their own: headers etc show up fine if there is no data when run "standalone".
    the reports-that-are-subreports are based on embedded SQL in the subreport (i.e. not on standalone queries, not on SQL generated from code)
    the mother report contains only a header caption.

    izy
    currently using SS 2008R2

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    Q2 is fixed:
    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        gloReportException = vbNullString
        If Not Me.rptQC01.Report.HasData Then
            gloReportException = gloReportException & "aaaaa aaaa aaaaaaaaa" & vbNewLine
        End If
        If Not Me.rptQC02.Report.HasData Then
            gloReportException = gloReportException & "bb bbbbbb bbbbbbbbbb" & vbNewLine
        End If
        If Not Me.rptQC03.Report.HasData Then
            gloReportException = gloReportException & "cc ccccccc ccccccccc" & vbNewLine
        End If
        If Not Me.rptQC04.Report.HasData Then
            gloReportException = gloReportException & "d ddddd dddddddddddd" & vbNewLine
        End If
        'etc etc etc
    End Sub
    
    Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
        If LenB(gloReportException) > 0 Then
            Me.boxException = "The following QC checks had zero errors:" & vbNewLine & gloReportException
        End If
    End Sub
    still no ideas for Q1

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I did a quick test of the following code and it seems to work in simple situations I tested.

    Code:
    Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
        
        Dim strMissingData As String
        
        strMissingData = strMissingData & IIf(Me.srptTest.Report.HasData, "", "Missing Subreport 1" )
        
        txtFooter = strMissingData
        
    End Sub
    I am not sure how you would present the message, but I added txtFooter to the footer section and with a series of assignment statements it seems to me you could create a string to report all of the subreports with no exceptions.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    thanks DCK -i found a route to grabbing the reports that were supressed and stuffing related text at the end of the mother report.

    but i'm still intrigued by switching on/off the suppression of empty subreports "feature" and i haven't found the switch yet.

    izy
    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •