Totalling subreports in main report?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henrootje

    Totalling subreports in main report?

    I have a report concerning a customer.
    In this report we find four subreports. They are in layout identical
    but data comes from different tabel.
    Now on the main report I count the totals of each report and sum them;

    =[rptGBBGroepsIDJ aaroverzicht1].[Report]![Tekst100]+[Sub141].[Report]![Tekst100]+[Sub142].[Report]![Tekst100]

    But if of of the subreports has no data for example because it has no
    data I get an error...

    How can I tell the totalling field that, if for example subreport 141
    not exists, it should ignore the missing report?

    A function like the X=nz([a])+nz([b])+nz([c])+nz([d]) but then for
    reports........ ..

    Anyone having a bright idea?

    TIA, Henro

  • Allen Browne

    #2
    Re: Totalling subreports in main report?

    Test the HasData property of the report in each subreport:

    =IIf([rptGBBGroepsIDJ aaroverzicht1].[Report].HasData,
    Nz([rptGBBGroepsIDJ aaroverzicht1].[Report]![Tekst100], 0), 0)
    + IIf([Sub141].[Report]![Tekst100].HasData,
    Nz([Sub141].[Report]![Tekst100],0), 0)
    + ...

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Henrootje" <HenroV@gmail.c om> wrote in message
    news:1151408136 .254782.19590@y 41g2000cwy.goog legroups.com...[color=blue]
    >I have a report concerning a customer.
    > In this report we find four subreports. They are in layout identical
    > but data comes from different tabel.
    > Now on the main report I count the totals of each report and sum them;
    >
    > =[rptGBBGroepsIDJ aaroverzicht1].[Report]![Tekst100]+[Sub141].[Report]![Tekst100]+[Sub142].[Report]![Tekst100]
    >
    > But if of of the subreports has no data for example because it has no
    > data I get an error...
    >
    > How can I tell the totalling field that, if for example subreport 141
    > not exists, it should ignore the missing report?
    >
    > A function like the X=nz([a])+nz([b])+nz([c])+nz([d]) but then for
    > reports........ ..[/color]


    Comment

    • Henrootje

      #3
      Re: Totalling subreports in main report?

      Thanks Alan!


      Allen Browne schreef:
      [color=blue]
      > Test the HasData property of the report in each subreport:
      >
      > =IIf([rptGBBGroepsIDJ aaroverzicht1].[Report].HasData,
      > Nz([rptGBBGroepsIDJ aaroverzicht1].[Report]![Tekst100], 0), 0)
      > + IIf([Sub141].[Report]![Tekst100].HasData,
      > Nz([Sub141].[Report]![Tekst100],0), 0)
      > + ...
      >
      > --
      > Allen Browne - Microsoft MVP. Perth, Western Australia.
      > Tips for Access users - http://allenbrowne.com/tips.html
      > Reply to group, rather than allenbrowne at mvps dot org.
      >
      > "Henrootje" <HenroV@gmail.c om> wrote in message
      > news:1151408136 .254782.19590@y 41g2000cwy.goog legroups.com...[color=green]
      > >I have a report concerning a customer.
      > > In this report we find four subreports. They are in layout identical
      > > but data comes from different tabel.
      > > Now on the main report I count the totals of each report and sum them;
      > >
      > > =[rptGBBGroepsIDJ aaroverzicht1].[Report]![Tekst100]+[Sub141].[Report]![Tekst100]+[Sub142].[Report]![Tekst100]
      > >
      > > But if of of the subreports has no data for example because it has no
      > > data I get an error...
      > >
      > > How can I tell the totalling field that, if for example subreport 141
      > > not exists, it should ignore the missing report?
      > >
      > > A function like the X=nz([a])+nz([b])+nz([c])+nz([d]) but then for
      > > reports........ ..[/color][/color]

      Comment

      Working...