Solved

If subreport has no data, do not show text

Posted on 2014-02-06
2
438 Views
Last Modified: 2014-02-06
I have a second page on an Access report that I do not want shown if there is no data in the subreport that makes up that second page. My subreport does not appear if it is empy so I'd like the text above it to also not appear.  I'd really not even like a second page, if possible.  
My subreport is tblContractAiringDatesSubreport.  
The text I"m trying to hide is Text165.

I cannot get the syntax to work:
Private Sub tblContractAiringDateSubreport_Enter()
If Me.Report.HasData Then
    Me.Text165.Visible = True
 Else
    Me.Text165.Visible = False
End If
End Sub

I'm not even sure if this is where I should be putting the If statement.
But also not sure the subreport is being reference correctly.
Thanks in advance for any help.
0
Comment
Question by:haident
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39839173
try this in the control source of the textbox


=IIf([tblContractAiringDatesSubreport].[Report].[HasData],Null,'NO data to display')
0
 

Author Closing Comment

by:haident
ID: 39839705
Thanks!  Worked if I rearranged the IIf to put Null if no false, and I get because I then display my merged text.  But what if I just want to diaplsy an image?  What do I put in the TRUE part?

=IIf([tblContractAiringDates subreport].[Report].[HasData],DLookUp("VendorAddressAddr1","tblVendor","VendorName= '" & [Station] & "'") & " Specific Airdates for " & [Start Date] & " - " & [Expiration] & " contract:",Null)
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

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…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

770 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