IIF Statement

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
 
D

Duane Hookom

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

Fons Ponsioen

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
 

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