Hiding Subreports and triggering visibilities

S

selesti

I've read through several threads on here, thescripts.com, and Allen
Browne's site and although I've seen several related situations I still
can't quite seem to get this to work.

I have a report that spits out a single job's detail (the job number is
a parameter in the query the report runs off of), and it has several
subreports that may or may not have data in them, depending on the job.

From what I've read and experimented, if the subreport doesn't have
data (based off of a query that finds nothing) then it completely does
not appear on the report. This is good. However, I am trying to turn
visible a hidden label behind the subreport if there is no data, and so
far it's not working.

I first tried on the subreports "On No Data" adding this event
procedure:

Reports!PreJCAnalysis!Lab_NoUnion.Visible = True

I tested the procedure syntax and it works, but for some reason isn't
working when I run the report.

I then tried to put the code in the Report_Open of my main report,
using

If Me!PreCrewSub.Report.HasData = False Then
!Reports!PreJCAnalysis!Lab_NoUnion.Visible = True
Else
!Reports!PreJCAnalysis!Lab_NoUnion.Visible = False
End If

Even with several variations, I keep getting Run-time error #2455 - You
entered an expression that has an invalid reference to the property
Form/Report.

Pointing to the first line. I feel like I'm missing something obvious
- any help would be greatly appreciated, thanks.
 
D

Duane Hookom

Try use a text box with a control source like:

=IIf(srptName.Report.HasData, Null, "Alternative Text")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top