Link to home
Start Free TrialLog in
Avatar of terpsichore
terpsichore

asked on

Subreport - make invisible in Report View

Dear experts -
I have a subreport which I would like to make invisible if it contains no records - it does this OK in Print Preview, but NOT in Report View.
Any ideas?
Thanks!
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Put a textbox in the header or footer of your subreport and in its ControlSource insert this:
=Count (*)
Let's call it txtCount.  Then in the OnLoad event of your report, add this:
Me.NameOfSubreportControl.Visible = (Me.NameOfSubreportControl.Report!txtCount > 0)
Avatar of terpsichore
terpsichore

ASKER

i want the subreport to be visible or not depending on the value of the parent record.
For example, we have:
Project 1
- subreport may be visible or not
Project 2
- subreport may be visible or not
Project 3
- subreport may be visible or not

Will this work in that case?
Looks like you have this subreport in the Detail section.  Normally you would put the code in the OnFormat property of the Detail section; however, this will only work in Print Preview and when printing the report.  It will not work in Report View.
there is no workaround?
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
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
extremely thorough. thanks.