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!
Microsoft Access

Avatar of undefined
Last Comment
terpsichore

8/22/2022 - Mon
IrogSinta

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)
ASKER
terpsichore

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?
IrogSinta

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.
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER
terpsichore

there is no workaround?
ASKER CERTIFIED SOLUTION
IrogSinta

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
terpsichore

extremely thorough. thanks.