Solved

Hide detail section of report if subreport has no data

Posted on 2014-04-01
3
2,324 Views
Last Modified: 2014-04-01
On a report in the detail section I have a sub-report.  If there is no data in the sub-report I want to hide the detail section record.

Can this be done?

--Steve
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:NARANTHIRAN
ID: 39969070
Yes its possible..

Turn on Suppress Blank Section in the main report selection..
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39969081
Add the following to your Detail Format event in the main report:

    If Me.MySubReportName.Report.HasData = False Then Me.Detail.Visible = False

Open in new window


Or this (shorthand):

    Me.Detail.Visible = Me.MySubReportName.Report.HasData

Open in new window

0
 

Author Closing Comment

by:SteveL13
ID: 39969169
I used the shorthand version.  Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

729 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