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
Solved

How to hide subreport label if subreport has no data

Posted on 2012-04-10
9
2,794 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

829 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