IIf Function

  • Thread starter Thread starter Josh
  • Start date Start date
J

Josh

I am trying to Create an IIf statement in a Report so that
when I divide two variables and they happen to be zeros
that they don't come out with the zero error in the
Report.
 
Josh said:
I am trying to Create an IIf statement in a Report so that
when I divide two variables and they happen to be zeros
that they don't come out with the zero error in the
Report.

As a controlsource:

=IIf([Denominator] = 0, 0, [Numerator]/[Denominator])

As a calculated field in a query (in the design-view field grid):

Quotient: IIf([Denominator] = 0, 0, [Numerator]/[Denominator])

As a calculated field in a query (SQL view):

SELECT
Numerator,
Denominator,
IIf([Denominator] = 0, 0, [Numerator]/[Denominator])
As Quotient
FROM MyTable;
 
Back
Top