Solved

Hide detail section of report if subreport has no data

Posted on 2014-04-01
3
2,229 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
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

831 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