Problem with =IIF in Report

  • Thread starter Thread starter Connell Giacomini
  • Start date Start date
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?
 
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 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))
 
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))
 
Back
Top