?
Solved

How to hide subreport label if subreport has no data

Posted on 2012-04-10
9
Medium Priority
?
2,927 Views
Last Modified: 2012-04-16
I'm trying to hide the subreport label if there is no data in the subreport.

I've researched three solutions on EE and none seem to work for me.

the subreport is a thin line with "Can Grow", that part works great.

I put the label in the sub-report header but it displays every time even if there is no data.

I tried detail_format function also to no avail . . .

Then I tried
Private Sub Report_Current()

    If Me.rptPositionsByCandidate.Report.HasData = True Then
       
        Me.Candiate_Other.Visible = True
    Else
        Me.Candiate_Other.Visible = False
    End If

End Sub

from here , still no luck - the subreport label prints every time.

see attached, run the first report
Candidates-EE.accdb
0
Comment
Question by:Alaska Cowboy
[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
  • 5
  • 2
  • 2
9 Comments
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 1050 total points
ID: 37830089
Try this in the on format event for the section with the label on the parent report:

Me.Candiate_Other.Visible = Me.rptPositionsByCandidate.Report.HasData 

Open in new window

0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 450 total points
ID: 37830114
0
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 1050 total points
ID: 37830137
I did not see that you had an attachment.   This new site skin is really hard for me to see. Poor contrasts in colors.

It was really simple to fix. I just moved the label the the Sub report's Report Header setion. No VBA code needed. Acvess will handle it automatically

See attached
Candidates-EE-HiTechCoach.accdb
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:Alaska Cowboy
ID: 37830395
Thank you ThHiTechCoach, I will try it out tomorrow.

Jeff, thanks for the link
0
 
LVL 1

Assisted Solution

by:Alaska Cowboy
Alaska Cowboy earned 0 total points
ID: 37830835
TheHiTechCoach - the label still displays if there are no records in the subreport, see "Environment - Refuse Manager - Comanichi" (and others below that).
- I had also tried that to no avail

I also tried your first suggestion to no avail (see attached)
-->Me.Candidate_Other.Visible = Me.rptPositionsByCandidate.Report.HasData

Jeff, thanks, but that link seemed to be about handling a report with no data, so I didn't see the connection.
Candidates-EE.accdb
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 450 total points
ID: 37830954
<I'm trying to hide the subreport label if there is no data in the subreport.>
Actually it's a textbox...

<the label still displays if there are no records in the subreport, see "Environment - Refuse Manager - Comanichi" (and others below that).>
Am I missing something?
For ""Environment - Refuse Manager - Comanichi""
...I *do not* see the textbox...
screen
0
 
LVL 1

Author Comment

by:Alaska Cowboy
ID: 37830971
>> >><I'm trying to hide the subreport label if there is no data in the subreport.>
>>Actually it's a textbox...
- yes, good point, that was on purpose.

but the d.b. I just posted shows this:

report_pic
Thanks a lot, will pick it up tomorrow :-)
0
 
LVL 1

Accepted Solution

by:
Alaska Cowboy earned 0 total points
ID: 37831138
I ended up solving this by adding a field to the sub-report with this expression:

=IIf(IsNull([Position_Descr_Long]),Null,"Other Positions:")

So if there is no data in the subreport nothing displays.

This shows on the report like this:

Position: Controller
    Candidate: John Doe
         Other Positions:  Marketing Director
                                     COO

not the prettiest and elegant, but it works. I do appreciate the help as it's helping me get over the initial learning curve.
0
 
LVL 1

Author Closing Comment

by:Alaska Cowboy
ID: 37850279
I couldn't get the suggestion to work, but I've seen the same thing in other questions.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

771 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