Calculated field & hiding #Error results

  • Thread starter Thread starter Opal
  • Start date Start date
O

Opal

I have a calculated field in a report I am running in Access 2003.
The report shows attendance percentages for 3 shifts over 3 zones.
However, only one shift has
employees in the third zone, the other two do not. When I run the
report I get
#Error because the calculated field is:

=[Zone1Actual]/[Zone1AuthRoll]

and Zone 1, for example, does not have an Authorized roll number so
the calculation
is zero divided by zero.

I thought that the following might work:

=Nz([Zone1Actual])/Nz([Zone1AuthRoll])

But I still get #Error in this field on the report. Any suggestions?
 
Opal said:
I have a calculated field in a report I am running in Access 2003.
The report shows attendance percentages for 3 shifts over 3 zones.
However, only one shift has
employees in the third zone, the other two do not. When I run the
report I get
#Error because the calculated field is:

=[Zone1Actual]/[Zone1AuthRoll]

and Zone 1, for example, does not have an Authorized roll number so
the calculation
is zero divided by zero.

I thought that the following might work:

=Nz([Zone1Actual])/Nz([Zone1AuthRoll])

But I still get #Error in this field on the report.


=IIf(Zone1AuthRoll=0, 0, [Zone1Actual]/[Zone1AuthRoll])

Also make sure the text box is not named the same as one of
the fields in the expression.
 
Opal said:
I have a calculated field in a report I am running in Access 2003.
The report shows attendance percentages for 3 shifts over 3 zones.
However, only one shift has
employees in the third zone, the other two do not. When I run the
report I get
#Error because the calculated field is:
=[Zone1Actual]/[Zone1AuthRoll]

and Zone 1, for example, does not have an Authorized roll number so
the calculation
is zero divided by zero.
I thought that the following might work:
=Nz([Zone1Actual])/Nz([Zone1AuthRoll])

But I still get #Error in this field on the report.

=IIf(Zone1AuthRoll=0, 0, [Zone1Actual]/[Zone1AuthRoll])

Also make sure the text box is not named the same as one of
the fields in the expression.

--
Marsh
MVP [MS Access]- Hide quoted text -

- Show quoted text -


Thank you Marsh and Duane, that works perfectly :-)
 
Back
Top