IIF Statement

  • Thread starter Thread starter LaShon
  • Start date Start date
L

LaShon

Help. I'm going to try to make as much sense as possible.

I am sort of a beginner in Access and am working on a
report in Access 97. I have a calculation in a sub report
that works but, if the result of the calculation is 0, I
get #Error instead of 0. This is the formula:

=[rptCritical].[Report]![TotCrtError]/[Col2].

I know it calls for an IIF statement but, I have no idea
how to do it. Your help is very much appreciated.

Thanks
 
I assume you get an error when the subreport has no data. Try
=IIf([rptCritical].[Report].HasData AND Col2<>0,
[rptCritical].[Report]![TotCrtError]/[Col2], 0)
 
Use of the IIF statement would look like IIF([rptCritical].
[Report]![TotCrtError] is null,0,[rptCritical].[Report]!
[TotCrtError])
this would substitute a zero if [TotCrtError] is null
You also could use the NZ([rptCritical].[Report]!
[TotCrtError]) function.
Hope this helps
Fons
 
Back
Top