Calculated field & hiding #Error results

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?
 
M

Marshall Barton

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.
 
O

Opal

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 :)
 

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