Solved

Display label when subreport empty

Posted on 2009-07-15
2
276 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
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 250 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
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…
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 …

821 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