Results 1 to 5 of 5
  1. #1
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085

    Sub Report with No data


    I have an Access 2010 Report that contains 2 sub reports. Each Detail line may populate 0,1 or both of the subreports. I have each Subreport set to can Grow, Can shrink set to Yes. I want the subreport label to only be visible when the subreport contains data. In the subreport No Data How do I reference the main report label for that subreport so I can set visible = false????

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Actually, in the On Format event of the section on the main report you would want to do the check:
    Code:
    Me.LabelNameHere.Visible = (Me.SubReportControlName.Report.HasData)

  3. #3
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    This is what I put in but I get the error Message Method or data member not found
    What am I missing? I typed hasdata Access changed it to HasData but I still get the error message????

    Me.Previous_Admits_Label.Visible = Me.Previous_Admits.HasData
    Me.Cases_Label.Visible = Me.Cases.HasData

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by RayMilhon View Post
    This is what I put in but I get the error Message Method or data member not found
    What am I missing? I typed hasdata Access changed it to HasData but I still get the error message????

    Me.Previous_Admits_Label.Visible = Me.Previous_Admits.HasData
    Me.Cases_Label.Visible = Me.Cases.HasData
    Nope, you aren't using it correctly. Remember you need to refer to the subreport CONTROL (control on the parent report which HOUSES the subreport and is not the subreport itself unless they are named exactly the same). And you need to add the .Report. part.

    So - if your subreport control name is actually Previous_Admits and not Previous_Admits subreport (same with cases), it would be:

    Code:
    Me.Previous_Admits_Label.Visible = Me.Previous_Admits.Report.HasData
    Me.Cases_Label.Visible = Me.Cases.Report.HasData
    But if it is the other then:
    Code:
    Me.Previous_Admits_Label.Visible = Me.[Previous_Admits subreport].Report.HasData
    Me.Cases_Label.Visible = Me.[Cases subreport].Report.HasData

  5. #5
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    Thank you Bob You're a great help as always

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

Similar Threads

  1. data does not appear on the report
    By Renata Costa in forum Reports
    Replies: 4
    Last Post: 04-07-2011, 09:21 AM
  2. Can Data be Stored in a Report
    By jgross in forum Reports
    Replies: 1
    Last Post: 02-02-2011, 10:31 PM
  3. Missing data in report
    By newtoAccess in forum Reports
    Replies: 1
    Last Post: 12-01-2010, 10:40 AM
  4. Duplicate data in report
    By JKrause in forum Reports
    Replies: 0
    Last Post: 03-23-2010, 10:07 AM
  5. Report SQL/Data in Access
    By artfuldodger in forum Access
    Replies: 2
    Last Post: 09-01-2006, 07:38 AM

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