Sum Question.

  • Thread starter Thread starter Steve Roberts
  • Start date Start date
S

Steve Roberts

Access 2003 .ADP project SQL 7.0

I have a report that I need to get grand totals for certain fields based on
other information in each detail.

The logic would be:
If [FieldToTest] = 13 then sum[Amount] for all of the records that match.

This is the code I have in a field in the Report footer:

=Sum(If([REASON]=13,[AMOUNT]))

I get the following error:
Aggregate functions are only allowed on output fields of the record scouce.

Thanks in advance for your suggestions

Steve
 
Steve said:
Access 2003 .ADP project SQL 7.0

I have a report that I need to get grand totals for certain fields based on
other information in each detail.

The logic would be:
If [FieldToTest] = 13 then sum[Amount] for all of the records that match.

This is the code I have in a field in the Report footer:

=Sum(If([REASON]=13,[AMOUNT]))

I get the following error:
Aggregate functions are only allowed on output fields of the record scouce.


The function is IIf, not If.

Also, make sure that Reason and Amount are fields in the
report's record source.
 
Back
Top