Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

totals from subreports without records

Status
Not open for further replies.

breakfast

Programmer
Jul 19, 2000
1
US
I have a report with 2 subreports. I want to take the totals from the sub reports and total them on the main report. However one of the subreport will sometimes not have any records. I still would like to total the two subreports together giving the subreport without any records a 0.00 value. Example: subreport1 total=$5, subreport2 total=$10, total on main report=$15,,,Subreport1 total=$5, subreport2 has no records but total=$0.00, total on main report=$5. I hope i made that clear. Thanks for the help
 
Let's call the textboxes containing the subreport totals in the two forms Sub1Total and Sub2Total.<br>Your main report textbox control source should be:<br><br>=nz([Sub1Total])+nz([Sub2Total])<br><br>I'm not absolutely sure this will work since I haven't tested it.&nbsp;&nbsp;Let me know if it doesn't work and I'll look at it again.
 
Hi breakfast and rochelle,

I was searching for help on this same issue and found the answer (at least for me) in another post.

Nz() doesn't necessarily work, since the subreport is just not present when there are no records. However, if the message you get in the control with the subreport's control's reference is &quot;#Error&quot;, try this:

= IIF(IsError(subform1![field1]), 0, subform1![field1])

as the control's source.

JerryDennison posted this solution on May 31, 2001 in another thread.

Heather

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top