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
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?
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

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.
Avatar of terpsichore
terpsichore

ASKER

there is no workaround?
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of terpsichore
terpsichore

ASKER

extremely thorough. thanks.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo