Solved

Hide Subreport if no records

Posted on 2016-08-28
7
38 Views
Last Modified: 2016-08-28
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.
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 21
ID: 41773697
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
 

Author Comment

by:pdvsa
ID: 41773703
Hi, I actually did try that and it doesnt seem to hide it.
0
 
LVL 21
ID: 41773708
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:pdvsa
ID: 41773744
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
 
LVL 21

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 500 total points
ID: 41773751
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
 

Author Closing Comment

by:pdvsa
ID: 41773784
Ok thank you.
0
 
LVL 21
ID: 41773802
you're welcome ~ happy to help
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question