Problem with =IIF in Report

C

Connell Giacomini

I need two totals in my report footer. The first adds the field [Amount],
and works fine.

The second is intended to also add the field [Amount], but only where the
checkbox field [Pledge] is checked. I am using the following espressions:

Total Amount: =IIf([Pledge]=False,Sum([Amount]),0) (This works
perfectly)

Total Pledged: =IIf([Pledge]=True,Sum([Amount]),0) (This always produces a
total of 0.00 whether the checkbox [Pledge] is checked or not.


Any idea what is wrong with the second expression?
 
F

fredg

I need two totals in my report footer. The first adds the field [Amount],
and works fine.

The second is intended to also add the field [Amount], but only where the
checkbox field [Pledge] is checked. I am using the following espressions:

Total Amount: =IIf([Pledge]=False,Sum([Amount]),0) (This works
perfectly)

Total Pledged: =IIf([Pledge]=True,Sum([Amount]),0) (This always produces a
total of 0.00 whether the checkbox [Pledge] is checked or not.

Any idea what is wrong with the second expression?

Does this help:

Total Amount: =Sum(IIf([Pledge]=0,Nz([Amount],0),0)
Total Pledged: =Sum(IIf([Pledge]=-1,Nz([Amount],0),0))
 
F

fredg

I need two totals in my report footer. The first adds the field [Amount],
and works fine.

The second is intended to also add the field [Amount], but only where the
checkbox field [Pledge] is checked. I am using the following espressions:

Total Amount: =IIf([Pledge]=False,Sum([Amount]),0) (This works
perfectly)

Total Pledged: =IIf([Pledge]=True,Sum([Amount]),0) (This always produces a
total of 0.00 whether the checkbox [Pledge] is checked or not.

Any idea what is wrong with the second expression?

Does this help:

Total Amount: =Sum(IIf([Pledge]=0,Nz([Amount],0),0)
Total Pledged: =Sum(IIf([Pledge]=-1,Nz([Amount],0),0))

I left off the final ")" in the Total Amount expression.
It should be:
Total Amount: =Sum(IIf([Pledge]=0,Nz([Amount],0),0))
 
C

Connell Giacomini

Both of your expressions worked perfectly! Thank you very much.

fredg said:
I need two totals in my report footer. The first adds the field
[Amount],
and works fine.

The second is intended to also add the field [Amount], but only where
the
checkbox field [Pledge] is checked. I am using the following
espressions:

Total Amount: =IIf([Pledge]=False,Sum([Amount]),0) (This works
perfectly)

Total Pledged: =IIf([Pledge]=True,Sum([Amount]),0) (This always
produces a
total of 0.00 whether the checkbox [Pledge] is checked or not.

Any idea what is wrong with the second expression?

Does this help:

Total Amount: =Sum(IIf([Pledge]=0,Nz([Amount],0),0)
Total Pledged: =Sum(IIf([Pledge]=-1,Nz([Amount],0),0))

I left off the final ")" in the Total Amount expression.
It should be:
Total Amount: =Sum(IIf([Pledge]=0,Nz([Amount],0),0))
 

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