Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display label when subreport empty

Posted on 2009-07-15
2
Medium Priority
?
279 Views
Last Modified: 2013-11-28
I have a report that contains a subreport.  When the subreport does not have any data to display I would like a label to appear with a message saying "No New Clients".  I have the label on the subreport with the visible property set to false.  I also have the below code.  This works when I run the subreport separately, but when I run it with the main report it does not work.  Any suggestions?
Private Sub Report_NoData(Cancel As Integer)
    Me.lblNNC.Visible = True
End Sub

Open in new window

0
Comment
Question by:nfstrong
[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
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 1000 total points
ID: 24860678
Add  a label to the report behind the the subreport which has the caption of
"No Data To Report"

In the Format event procedure for the section that contains the subreport, do..

if Me.rptsub.Report.HasData = true then
    Me.rptsub.visible =  True
    Me. lblNoData.visible = False
else
   Me.rptsub.visible =  False
   Me. lblNoData.visible = True
end if

Use your own names for the label and the subreport, of course, instead of rptsub and lblnodata.
0
 
LVL 39

Expert Comment

by:thenelson
ID: 24860695
Put the label on the main report behind the subreport and use this code:
Private Sub Report_NoData(Cancel As Integer)
    Me.Parent.lblNNC.Visible = True
    Me.Visible = False
End Sub
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

704 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