SumIf on report

C

Chad

I have a report that returns 4 different records and is grouped by 'Type'.

I would like to return the sum of the values for every "Reserved" type in my
report footer.

I am able to create an IIF statement saying:

IIF([txtType] = "Reserved",[Total],0) - but obviously this will not check
each record

My next attempt was to sum the IFF statement as such:

Sum(IIF([txtType] = "Reserved",[Total],0)) - this prompts me to enter a
value for [txtType] and does not reference the field that is in place.

After searching the forums, I tried one more approach:

Abs(Sum(([txtType] = "Reserved)*[Total])) - but again this prompts me to
enter a value for [txtType] instead of referencing the text box that is on
the report.

In summary, I am able to reference [txtType] in other quations, but when I
tried the two above, I was prompted to enter a value for this field.

Any help or insight into this matter would be greatly appreciated.

Thanks!
Chad
 
D

Duane Hookom

You can't reference a control across report sections in an aggregate
expression. If txtType is a text box in the detail section, you can't
reference it in a Sum() in a group section. You can try replace txtType with
its control source.
 
C

Chad

Thanks Duane, replacing txtType with the control source worked.



Duane Hookom said:
You can't reference a control across report sections in an aggregate
expression. If txtType is a text box in the detail section, you can't
reference it in a Sum() in a group section. You can try replace txtType with
its control source.

--
Duane Hookom
Microsoft Access MVP


Chad said:
I have a report that returns 4 different records and is grouped by 'Type'.

I would like to return the sum of the values for every "Reserved" type in my
report footer.

I am able to create an IIF statement saying:

IIF([txtType] = "Reserved",[Total],0) - but obviously this will not check
each record

My next attempt was to sum the IFF statement as such:

Sum(IIF([txtType] = "Reserved",[Total],0)) - this prompts me to enter a
value for [txtType] and does not reference the field that is in place.

After searching the forums, I tried one more approach:

Abs(Sum(([txtType] = "Reserved)*[Total])) - but again this prompts me to
enter a value for [txtType] instead of referencing the text box that is on
the report.

In summary, I am able to reference [txtType] in other quations, but when I
tried the two above, I was prompted to enter a value for this field.

Any help or insight into this matter would be greatly appreciated.

Thanks!
Chad
 

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