Hide Subreport if no records

Experts, I am trying to hide a subreport if there are no records.   Not sure if this is with Dcount or using a txtCounter. The table is tblRepayments and the parent and sub are linked on tblDraws.ID and tblDraws_Details1.DrawIDRpmt.

thank you.
pdvsaProject financeAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
crystal (strive4peace) - Microsoft MVP, AccessConnect With a Mentor Remote Training and ProgrammingCommented:
Report View doesn't run code

you might try setting controls heights on subreport to something very small like 0.1 -- and subreport control very small too -- and CanGrow to Yes. you will still get 1 row but it won't be as tall. Make sure no borders around any controls or subreport control so all that will happen is just a little more space.
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
try setting the Can Shrink property of the subreport control to Yes (True) -- near the bottom of the Format tab of the Property Sheet (Alt-Enter if it is not showing)
0
 
pdvsaProject financeAuthor Commented:
Hi, I actually did try that and it doesnt seem to hide it.
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
this will work in Print Preview but not Report View -- assuming subreport is in the detail section (if not, change accordingly:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'160828 s4p
   With me.controlname_Subreport
      .Visible = .Report.HasData
   End With
End Sub

Open in new window

0
 
pdvsaProject financeAuthor Commented:
hmmm that did seem to turn it off in print preview like you said but I dont use print preview much at all and am more interested in turning if off in Report View.  Let me know if you think of something.  I did have code for this but I have lost the db.  thank you for the help...
0
 
pdvsaProject financeAuthor Commented:
Ok thank you.
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you're welcome ~ happy to help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.