need SUM of field containing IIF statement

  • Thread starter Thread starter Ken Smith
  • Start date Start date
K

Ken Smith

First of all, it appears the IIf statement is out of whack:

IIf([teamcr_rates.rate],[teamcr_rates.rate],
[teamc_amounts.amount])

should read something like

IIf([teamcr_rates.rate]=?,[teamcr_rates.rate],
[teamc_amounts.amount])

An IIf statement evaluates if a condition is true and
reports the value following the test phrase (which hasn't
been finished in your code) or the last phrase of the test
is false. You will need to put something in place of the
=? that defines what your test is. Then everything should
work.

-----Original Message-----
I have a field [rates_old] on my form that contains the following IIF statement

=IIf([teamcr_rates.rate],[teamcr_rates.rate], [teamc_amounts.amount])

Then I want to put the SUM of the field results in the
footer of the report. When I just use values from one of
the sources, the SUM function works fine. When I use the
IIF statement, I get an #error in the SUM function. What
do I need to do to get the SUM of the IIF statement
results? I've tried a number of things, but to no avail.
Thanks in advance...
 
That was the ticket. Thank you!
-----Original Message-----
First of all, it appears the IIf statement is out of whack:

IIf([teamcr_rates.rate],[teamcr_rates.rate],
[teamc_amounts.amount])

should read something like

IIf([teamcr_rates.rate]=?,[teamcr_rates.rate],
[teamc_amounts.amount])

An IIf statement evaluates if a condition is true and
reports the value following the test phrase (which hasn't
been finished in your code) or the last phrase of the test
is false. You will need to put something in place of the
=? that defines what your test is. Then everything should
work.


-----Original Message-----
I have a field [rates_old] on my form that contains the following IIF statement

=IIf([teamcr_rates.rate],[teamcr_rates.rate], [teamc_amounts.amount])

Then I want to put the SUM of the field results in the
footer of the report. When I just use values from one of
the sources, the SUM function works fine. When I use the
IIF statement, I get an #error in the SUM function. What
do I need to do to get the SUM of the IIF statement
results? I've tried a number of things, but to no avail.
Thanks in advance...
.
 
Back
Top