Results 1 to 7 of 7
  1. #1
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87

    Hide SubReport

    I know this has been asked at least a dozen times but it's not working for me. I have one report on top of the other. Report A will never have NoData so I set the OnNoData property on Report B to visible = false on NoData. Problem is when Report B does have data I can see Report A behind it.

    I've tried setting Report A's visible to false;
    on Report B's OnNoData
    on the main report on focus and current
    on Report A's format

    None of it seems to be working. Help

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you opening two reports at the same time?

  3. #3
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87
    Nope. Report A is static (coming from a code table its a list of other services the company code provide and cost for those services). Report B is a list of the extra services the company actually used that month. So if they used extra services they don't need to see the cost of services offered i.e. Report A.

    Report B is very good about going away when it has NoData. Report A is not cooperative about disappearing when Report B does have data.

    my code has been looking something like:
    If ReportB.hasdata then
    ReportA.visible = false
    End if

    Not Working on Report or Detail, load, format, activate, Paint,
    I've even tried on the subreports on load, format, etc.

    I was just thinking, in Crystal I could create two groups and put each report in one. I don't see a way to do that in Access....do you know of any?

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you could do something like this in the ON OPEN property of the report


    Code:
    if dcount("*", "QueryDrivingReportB") = 0 then
        reporta.visible = true
    else
        reporta.visible = false
    endif
    Where you're counting the number of records that are in the collection report b, and if there are 0 records report a is visible otherwise it's not.

    You could likely do the same thing by checking the visible property of reportb and if it's visible making reporta invisible.

  5. #5
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87
    I tried the visible thing but no matter where i put it - Rerport A ignored the request to disappear .

    I'll try to dcount. Should I put this in on the on open of the main report or report a - I'll try both.

  6. #6
    TinaCa is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    87
    LOL I copied an old copy of the report back to the current database....and the dumb form is working. I hate that - I thought this was working before. Here is the code that finally made Report A disappear. It is in the format event of the detail section.


    Me.rptInvoiceExtrasSub.Visible = Me.rptInvoiceExtrasSub.Report.HasData
    If Me.rptInvoiceExtrasSub.Visible = True Then
    Me.rptInvExtrasSub.Visible = False
    Else
    Me.rptInvExtrasSub.Visible = True
    End If

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Thanks for posting back with your success and solution.

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

Similar Threads

  1. Criteria for Subreport
    By blazerboy6 in forum Reports
    Replies: 4
    Last Post: 08-09-2011, 12:46 PM
  2. Empty Subreport
    By runbear in forum Reports
    Replies: 5
    Last Post: 04-23-2011, 12:26 PM
  3. query as subreport
    By karent11 in forum Reports
    Replies: 1
    Last Post: 09-21-2010, 11:02 AM
  4. Report and Subreport
    By newbie in forum Reports
    Replies: 0
    Last Post: 02-16-2010, 12:14 PM
  5. Show Hide Subreport / acViewReport
    By BigBear in forum Reports
    Replies: 4
    Last Post: 03-30-2009, 06:07 AM

Tags for this Thread

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