Results 1 to 6 of 6
  1. #1
    burt1215 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    34

    Removing The Boxes When The Report Has No Records

    Okay, hopefully an easy question.
    I have a report, that is based off of several sub reports.
    It looks like this.
    Click image for larger version. 

Name:	Report.jpg 
Views:	17 
Size:	88.9 KB 
ID:	25116
    As the applicant moves up in the application process, they move through the different sections. So they get removed from one sub report and in to the other.


    However, and I have no idea how this happened, but under the "Applicants Awaiting Training" section, there are boxes even though there are no records in the report.
    I'm looking for a way to get rid of those boxes when the query the report it is connected to pulls no records.
    Last edited by burt1215; 07-07-2016 at 02:41 AM.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Check the query the sub report uses, if zero records, then make the report invisible.
    in the ONPRINT event
    subrpt.visible = dcount("*","qsCountRpt1")>0

  3. #3
    burt1215 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    34
    Quote Originally Posted by ranman256 View Post
    subrpt.visible = dcount("*","qsCountRpt1")>0
    Super close.
    That made the entire rsub invisible. Including the header.
    Almost what I wanted.
    But I was able to from there edit it so it's just making the detail invisible.
    Either way, 10/10, thanks for helping me figure it out.

  4. #4
    burt1215 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    34
    Quote Originally Posted by ranman256 View Post
    subrpt.visible = dcount("*","qsCountRpt1")>0
    By the way, brilliant piece of code there.
    Super efficient testing it using a Boolean.

  5. #5
    burt1215 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    34
    Actually, one more question, and maybe I solve it before you get back to me.
    I've got code the runs this
    Code:
    Forms!frmGUI!fsubSchedule.Report!rsubApplicant4.Detail.Visible = (DCount("*", "qryApplicant4") > 0)
    It's checking it from the main form.
    It's basically identical to my code that updates the record source.
    Code:
    Forms!frmGUI!fsubSchedule.Report!rsubApplicant4.Report.RecordSource = Forms!frmGUI!fsubSchedule.Report!rsubApplicant4.Report.RecordSource
    Except it's saying object does not support this property or method.
    Straight from the report,
    Code:
    Me.Detail.Visible = (DCount("*", "qryApplicant4") > 0)
    Works perfectly.
    So I'm thinking I probably messed up somewhere with the reference.

  6. #6
    burt1215 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    34
    Got it.
    Code:
    Forms!frmGUI!fsubSchedule.Report!rsubApplicant4.Report.Detail.Visible = (DCount("*", "qryApplicant4") > 0)
    Thanks for all your help.
    Marked as solved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Removing Duplicate records
    By Brett1230 in forum Access
    Replies: 2
    Last Post: 01-28-2015, 01:22 PM
  2. Removing duplicate records with macros
    By sevanty7 in forum Access
    Replies: 1
    Last Post: 05-08-2013, 08:11 AM
  3. Replies: 6
    Last Post: 04-06-2013, 10:36 AM
  4. Replies: 21
    Last Post: 04-03-2013, 12:51 PM
  5. Removing Gaps from Report
    By caseym in forum Reports
    Replies: 2
    Last Post: 03-25-2011, 04:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums