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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Averaging a Subreport?

Status
Not open for further replies.

smoker1

Programmer
Jun 18, 2001
76
US
I have a subreport in one group header and it needs to be averaged in another header? Is this possible?
 
Yes it's possible but you need to make sure you reference the subform controls properly to do it. Here's a calculation I do in the detail section of a report that looks at two different subforms (rsubReturns and rsubSales) for a value, hopefully it will help you with setting yours up.

=[rsubReturns].[Report]![txtTotTotalQty]/[rsubSales].[Report]![txtTotTotalQty]

Joe Miller
joe.miller@flotech.net
 
Unfortunately, this doesn't work. I have used the expression builder to assist me also.

This simply returns the last value in the field, and doesn't return any data when I try to average it.
 
You may want to try looking up the DAvg function which will allow you to take the average of a field. Set your text box to look at the query that feeds your subreport instead of looking at the subreport itself. DAvg sample usage:

[tt]
=DAvg("[FieldNameToAvg]","QueryNameWithField","[MyID]=[MyID]")
[/tt]

Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top