Sum Question.

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
 
M

Marshall Barton

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top