Solved

Do Not Print Blank Subreport

Posted on 2013-06-10
2
552 Views
Last Modified: 2013-06-10
Attempting to suppress a blank subreport, contained in  group footer:

When group footer contains no records, linked subreport still prints!  #?@$?%!*&

Have tried:
-------------
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
       If rptHrsCat0_SR.Report.HasData = 0 Then
       rptHrsCat0_SR.Visible = False
       End If
End Sub
-------------

Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
With Me!rptHrsCat0_SR.Report
        .Visible = (.RecordsetClone.RecordCount > 0)
    End With
End Sub

-------------
In the Subreport On No Data property:
-------------
Private Sub Report_NoData(Cancel As Integer)
Cancel = True

End Sub
-------------

When the subreport is opened alone, only records containing data print.

Have made certain the Group Footer property: Can Shrink = Yes
Have made certain ALL subreport properties: Can Shrink = Yes

Must be missing something here; would appreciate illumination.

Thank You, Jacob
0
Comment
Question by:Chi Is Current
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 39236869
Try this.  Use the subreport NoData event procedure...


Private Sub Report_NoData(Cancel As Integer)
     Cancel = True
End Sub

 Then...

 With the main report in design view,  set the Can Shrink property of the subreport container control to Yes, as well as the Can Shrink property of the group footer section.
0
 
LVL 2

Author Comment

by:Chi Is Current
ID: 39236881
Thank you for your reply, peter57r!!

Client is using the same field for different kinds of information!  #?@$?%!*&

In the interim decided to change strategies and write ODBC function to straighten out the data for the report.

Best Regards, Jacob
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question