Solved

How to hide subreport label if subreport has no data

Posted on 2012-04-10
9
2,697 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
  • 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
 
LVL 1

Author Comment

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

Jeff, thanks for the link
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

747 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

14 Experts available now in Live!

Get 1:1 Help Now