Avatar of SteveL13
SteveL13
Flag for United States of America asked on

Subreport will not shrink

I am having a lot of trouble getting a sub-report to shrink on a report if there is no data in the sub-report.  Therefore, the sub-report takes up a lot of room on the report leaving big gaps.  I have the text boxes set to Can Shrink = Yes.  I have made sure nothing overlaps.  I've made sure all objects are snapped to the grid.  On and on and on.

So now my question is...  Is there a way to make the height of the detail section be 0 if there is no data in the textbox and then bring it back to .1667 when the report is closed?
Microsoft Access

Avatar of undefined
Last Comment
SteveL13

8/22/2022 - Mon
bfuchs

make sure all the sections of the sub report are set to can shrink = yes.
the sub report itself on the main report should be set can shrink = yes.
and the section on the main report where the sub report is located should be set can shrink = yes.
SteveL13

ASKER
All 3 are set to Yes.
SteveL13

ASKER
And there are no labels on the sub-reports.  Only textboxes that are set to Yes.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
bfuchs

try removing everything from the subreport, see if thats still not shrinking.
if it works, then place back one by one, see what causes it not to shrink.
Jim Dettman (EE MVE)

Better yet, hide the whole subreport.  In the section it's in, OnFormat event, do:

  Me.<mysubreportcontrolname>.visible = Me!mysubreportcontrolname.Report.HasData

Jim.
Jim Dettman (EE MVE)

and BTW, note that your always better to set a subcontrol's height to 0 and let it grow rather than try and shrink it if you do use the other method.

Jim.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SteveL13

ASKER
Jim, I've tried hiding them but when I try to run the main report it keeps indicating that it can't find each of the sub-reports.  Do I need to somehow identify the parent report in the...  Me!mysubreportcontrolname.Report.HasData  ...part of the entire line of code?

Me.<mysubreportcontrolname>.visible = Me!mysubreportcontrolname.Report.HasData
Jim Dettman (EE MVE)

<<it can't find each of the sub-reports.  >>

  You need to be referring to the sub report control, not the name of the sub report object.

Jim.
ASKER CERTIFIED SOLUTION
Jim Dettman (EE MVE)

THIS SOLUTION 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
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
bfuchs

@Steve,
Have you tried my suggestion?
Your help has saved me hundreds of hours of internet surfing.
fblack61
SteveL13

ASKER
bfuchs  -  Yes.  Jim's suggestion seems to be working.