IIf problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have calculated field on my report. All is working fine when all data
exist, but when there is no data it is displaying #Error. I have tried
different variations of the IIf statement but nothing works so far. My
original calculations are as follows:

=Machine hours at commencement]+subrptHoursWorked1.Report![SumOfHours
Worked])/[Life expectancy]*100

The latest variation of the IIf statement I have tried is:

=IIf(([Life expectancy]>0 And subrptHoursWorked1.Report![SumOfHours
Worked]>0),([Machine hours at
commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,"")

How I need to modify my IIf to fix this problem ?

Thanks for help.

Tony
 
Hi Dennis,

I have tried your suggestion but it did no work. After few other tries I
have it working with the following syntax:

=IIf([Life expectancy]>0,IIf([Machine hours at commencement]>0,([Machine
hours at commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,0),0)

But I have one more IIf to fix. In second box I have:

=subrptServiceCost.Report![SumOfActual Cost]/[Annual R&M budget]*100

This box is giving me error when there is no SumOfActual Cost. How I can fix
this one ?? I have tried IsError and IsNull and they both fail.

Thanks for help.

Tony



Dennis said:
Try
=iif(IsError(YourCalculation),Null,YourCalculation)

Tony said:
I have calculated field on my report. All is working fine when all data
exist, but when there is no data it is displaying #Error. I have tried
different variations of the IIf statement but nothing works so far. My
original calculations are as follows:

=Machine hours at commencement]+subrptHoursWorked1.Report![SumOfHours
Worked])/[Life expectancy]*100

The latest variation of the IIf statement I have tried is:

=IIf(([Life expectancy]>0 And subrptHoursWorked1.Report![SumOfHours
Worked]>0),([Machine hours at
commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,"")

How I need to modify my IIf to fix this problem ?

Thanks for help.

Tony
 
Try
=Nz(subrptServiceCost.Report![SumOfActual Cost],0)/[Annual R&M budget]*100
Tony said:
Hi Dennis,

I have tried your suggestion but it did no work. After few other tries I
have it working with the following syntax:

=IIf([Life expectancy]>0,IIf([Machine hours at commencement]>0,([Machine
hours at commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,0),0)

But I have one more IIf to fix. In second box I have:

=subrptServiceCost.Report![SumOfActual Cost]/[Annual R&M budget]*100

This box is giving me error when there is no SumOfActual Cost. How I can fix
this one ?? I have tried IsError and IsNull and they both fail.

Thanks for help.

Tony



Dennis said:
Try
=iif(IsError(YourCalculation),Null,YourCalculation)

Tony said:
I have calculated field on my report. All is working fine when all data
exist, but when there is no data it is displaying #Error. I have tried
different variations of the IIf statement but nothing works so far. My
original calculations are as follows:

=Machine hours at commencement]+subrptHoursWorked1.Report![SumOfHours
Worked])/[Life expectancy]*100

The latest variation of the IIf statement I have tried is:

=IIf(([Life expectancy]>0 And subrptHoursWorked1.Report![SumOfHours
Worked]>0),([Machine hours at
commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,"")

How I need to modify my IIf to fix this problem ?

Thanks for help.

Tony
 
Hi Dennis,

:(

Tried, did not work. Any other suggestions.

#Error is displayed when in subreport there is no data
(subrptServiceCost.Report![SumOfActual Cost] is empty).

Tony

Dennis said:
Try
=Nz(subrptServiceCost.Report![SumOfActual Cost],0)/[Annual R&M budget]*100
Tony said:
Hi Dennis,

I have tried your suggestion but it did no work. After few other tries I
have it working with the following syntax:

=IIf([Life expectancy]>0,IIf([Machine hours at commencement]>0,([Machine
hours at commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,0),0)

But I have one more IIf to fix. In second box I have:

=subrptServiceCost.Report![SumOfActual Cost]/[Annual R&M budget]*100

This box is giving me error when there is no SumOfActual Cost. How I can fix
this one ?? I have tried IsError and IsNull and they both fail.

Thanks for help.

Tony



Dennis said:
Try
=iif(IsError(YourCalculation),Null,YourCalculation)

:

I have calculated field on my report. All is working fine when all data
exist, but when there is no data it is displaying #Error. I have tried
different variations of the IIf statement but nothing works so far. My
original calculations are as follows:

=Machine hours at commencement]+subrptHoursWorked1.Report![SumOfHours
Worked])/[Life expectancy]*100

The latest variation of the IIf statement I have tried is:

=IIf(([Life expectancy]>0 And subrptHoursWorked1.Report![SumOfHours
Worked]>0),([Machine hours at
commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,"")

How I need to modify my IIf to fix this problem ?

Thanks for help.

Tony
 
Try
=iif(IsError(subrptServiceCost.Report![SumOfActual
Cost]),Null,subrptServiceCost.Report![SumOfActual Cost]/[Annual R&M
budget]*100)
Tony said:
Hi Dennis,

:(

Tried, did not work. Any other suggestions.

#Error is displayed when in subreport there is no data
(subrptServiceCost.Report![SumOfActual Cost] is empty).

Tony

Dennis said:
Try
=Nz(subrptServiceCost.Report![SumOfActual Cost],0)/[Annual R&M budget]*100
Tony said:
Hi Dennis,

I have tried your suggestion but it did no work. After few other tries I
have it working with the following syntax:

=IIf([Life expectancy]>0,IIf([Machine hours at commencement]>0,([Machine
hours at commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,0),0)

But I have one more IIf to fix. In second box I have:

=subrptServiceCost.Report![SumOfActual Cost]/[Annual R&M budget]*100

This box is giving me error when there is no SumOfActual Cost. How I can fix
this one ?? I have tried IsError and IsNull and they both fail.

Thanks for help.

Tony



:

Try
=iif(IsError(YourCalculation),Null,YourCalculation)

:

I have calculated field on my report. All is working fine when all data
exist, but when there is no data it is displaying #Error. I have tried
different variations of the IIf statement but nothing works so far. My
original calculations are as follows:

=Machine hours at commencement]+subrptHoursWorked1.Report![SumOfHours
Worked])/[Life expectancy]*100

The latest variation of the IIf statement I have tried is:

=IIf(([Life expectancy]>0 And subrptHoursWorked1.Report![SumOfHours
Worked]>0),([Machine hours at
commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,"")

How I need to modify my IIf to fix this problem ?

Thanks for help.

Tony
 
Dennis,

Thank you for all your effort. It is working now.

Tony

Dennis said:
Try
=iif(IsError(subrptServiceCost.Report![SumOfActual
Cost]),Null,subrptServiceCost.Report![SumOfActual Cost]/[Annual R&M
budget]*100)
Tony said:
Hi Dennis,

:(

Tried, did not work. Any other suggestions.

#Error is displayed when in subreport there is no data
(subrptServiceCost.Report![SumOfActual Cost] is empty).

Tony

Dennis said:
Try
=Nz(subrptServiceCost.Report![SumOfActual Cost],0)/[Annual R&M budget]*100
:

Hi Dennis,

I have tried your suggestion but it did no work. After few other tries I
have it working with the following syntax:

=IIf([Life expectancy]>0,IIf([Machine hours at commencement]>0,([Machine
hours at commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,0),0)

But I have one more IIf to fix. In second box I have:

=subrptServiceCost.Report![SumOfActual Cost]/[Annual R&M budget]*100

This box is giving me error when there is no SumOfActual Cost. How I can fix
this one ?? I have tried IsError and IsNull and they both fail.

Thanks for help.

Tony



:

Try
=iif(IsError(YourCalculation),Null,YourCalculation)

:

I have calculated field on my report. All is working fine when all data
exist, but when there is no data it is displaying #Error. I have tried
different variations of the IIf statement but nothing works so far. My
original calculations are as follows:

=Machine hours at commencement]+subrptHoursWorked1.Report![SumOfHours
Worked])/[Life expectancy]*100

The latest variation of the IIf statement I have tried is:

=IIf(([Life expectancy]>0 And subrptHoursWorked1.Report![SumOfHours
Worked]>0),([Machine hours at
commencement]+subrptHoursWorked1.Report![SumOfHours Worked])/[Life
expectancy]*100,"")

How I need to modify my IIf to fix this problem ?

Thanks for help.

Tony
 
Back
Top