2

I am trying to accomplish the following in an Access 2010 query

Select  
    UNIT, DATE, Sum(IIF(ISERROR(A),NULL,A)) AS DLP_PERCENTAGE  
From  
    tableA;

where

A = (ACT-BASE)/BASE  

I get a generic OVERFLOW error. I am missing something obvious. I am trying to catch an error in the calculation and return NULL if an error exists or the result if no error. I have to do it in a query. Any ideas what I have overlooked?

DMadden51
  • 399
  • 5
  • 15
  • Check your math. That is what will cause the overflow. That type of error may not be recoverable, hence the reason the iff isn't working. – Nik Apr 29 '11 at 16:04
  • 1
    I don't think IsError() is used to trap errors. I believe it checks for error codes. – DMKing Apr 29 '11 at 16:06
  • I had to do it this way SUM((ACT-BASE)/IIF(BASE=0, 1, BASE)) AS DLP_PERCENTAGE – DMadden51 Apr 29 '11 at 16:25

1 Answers1

1
SUM((ACT-BASE)/IIF(BASE=0, Null, BASE)) AS DLP_PERCENTAGE
Saic Siquot
  • 6,513
  • 5
  • 34
  • 56