Solved

How make subreport shrink if value of a feild on the mainreport is "0"

Posted on 2013-05-30
1
386 Views
Last Modified: 2013-05-30
I have a report that has a subreport in the details section of the main report.  If the value of a certain field in the detail section of the main report is "0" then I want the subreport so shrink to 0" vertically in the detail section of the main report.

I have everything set to can shrink = yes in the detail section of the main report and also in the detail section of the subreport.  (The only section of the subreport with anything in it is the detail section).

Here's my onprint code for the detail section of the main report which isn't doing anything... (I also tried this in the onformat event)

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    If Me.txtSumOfScrap.Value = 0 Then
        Me.rptInternalScrapReportDefectCauses.Visible = False
        Else
        Me.rptInternalScrapReportDefectCauses.Visible = True
    End If

End Sub
0
Comment
Question by:SteveL13
1 Comment
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
Setting the Visible property won't allow Access to reclaim that space, but you might be able to set the .Height of the Subreport CONTROL to 0. I've not used that technique - it's better to fix your record pulls to ONLY pull valid data - but it may work.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now