Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sub Report Control (A2K)

    I have a report called rpt Inventory.
    It has a sub report with the control name txtRptKit
    The sub report has a control called txtPartNo

    I want a label on the main report the says KitParts when there is data in txtPartNo.

    The following works when there is data:

    =IIf([Reports]![rpt Inventory].[txtRptX]![txtPartNo]>" ","KitParts","")

    But gives me an #Error when there is no data present. Is there any way that I can negate the printing of #Error in this situation. Thanks as always in advance for any help
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sub Report Control (A2K)

    Is the subreport control named txtRptKit or txtRptX?

    Try
    <code>
    =IIf([txtRptKit].[Report].[HasData],IIf(IsNull([txtRptKit]![txtPartNo]),Null,"KitParts"),Null)
    </code>
    The HasData property is True if the (sub)report has records, False if it is empty.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sub Report Control (A2K)

    Hans,

    It was txtRptX and your solution, as usual, was bang on. Thanks kindly,
    Cheers,
    Andy

  4. #4
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sub Report Control (A2K)

    Hans,

    Nothing is so good that I can't try to make it more complicated. In my previous example I had alluded to one sub report only and the following solution, thanks to your help, worked perfectly with respect to three different subreports


    =IIf([txtRpt01].[Report].[HasData],IIf(IsNull([txtRpt01]![txtPartNo]),Null,"Equivalent Part Numbers"),Null)

    =IIf([txtRpt02].[Report].[HasData],IIf(IsNull([txtRpt02]![txtPartNo]),Null,"Kits Used In"),Null)

    =IIf([txtRpt03].[Report].[HasData],IIf(IsNull([txtRpt03]![txtPartNo]),Null,"Used In Part Numbers"),Null)

    They appeared in their correct format where the criteria of matching on part numbers was true. So that if a part number only had data in txtRpt01, only that sub report would print and the other two wouldn't, etc.

    Now,

    What I'm trying to do is test All SubReports in one swell foop and if there is no data in any of them, I want to negate printing the detail line on the Main Report. I've needless to say tried variations on the above theme and have not gotten too far other than to improve my typing skills.

    So, am I again "blowing" into the wind or is it possible to do the above. As always, am appreciative of any help offered,
    Cheers,
    Andy

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sub Report Control (A2K)

    Write code in the On Format event of the Detail section of the main report:
    <code>
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If Me.txtRpt01.Report.HasData = False And _
    Me.txtRpt02.Report.HasData = False And _
    Me.txtRpt03.Report.HasData = False Then Cancel = True
    End Sub</code>

  6. #6
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sub Report Control (A2K)

    Hans,

    How would you like to pop in for a great, Canadian Christmas dinner? I even drummed up a snowstorm yesterday so you could come and enjoy.

    Thanks muchly,
    Cheers,
    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •