Solved

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

Posted on 2013-05-30
1
387 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
ID: 39208887
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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.

896 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

19 Experts available now in Live!

Get 1:1 Help Now