Solved

How to hide subreport label if subreport has no data

Posted on 2012-04-10
9
2,834 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 350 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 150 total points
ID: 37830114
0
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 350 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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 150 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 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