subreport calculation if no data

  • Thread starter Thread starter disha
  • Start date Start date
D

disha

Hi

i have a report with fields -amt
and a subreport with fields - amt2
in the report footer i want to calculate the sum of the
main report and subreport field i.e. amt+amt2.
if the subreport has data it works fine but if it doesnt
have data then i get a blank.

i tried putting a macro on the on activate event to count
my subreport query records and if its 0 then set value of
sum in footer .....it then showed up right in the report
preview, but when i print that field print blank.
what am i doing wrong or how can i fix it.
please help im all confused
THANKS
 
disha said:
i have a report with fields -amt
and a subreport with fields - amt2
in the report footer i want to calculate the sum of the
main report and subreport field i.e. amt+amt2.
if the subreport has data it works fine but if it doesnt
have data then i get a blank.

When the subreport might not have any data, you should use:

=Amt + IIf(subreport.Report.HasData, subreport.Report.Amt2,
0)
 
Back
Top