Link to home
Start Free TrialLog in
Avatar of Haiden Turner
Haiden TurnerFlag for United States of America

asked on

If subreport has no data, do not show text

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.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Haiden Turner

ASKER

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)