Error

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

Guest

Hi,
I have got a question and please help
I know that if i put the following statement in the expression
IIf([amount] = 100, 0, 1 / 0), it will generate an error since IIF always
evaluates both condition even though the statement is 100% true...
is there anyway to work around it, i know i can use "if then else"
statement, but somehow, i must have to use IIF

Thanks
Edmund
 
In a query, the error does not occur. In VBA the error does occur.

SELECT IIF(100=100,1,1/0) as Test
FROM SomeTable

or

SELECT IIF(100<>100,1/0,1) as Test
FROM SomeTable

Both of those will not return an error value


On the other hand the following will return a divide by zero error since the
third expression does get evaluated
SELECT IIF(100<>100,1,1/0) as Test
FROM SomeTable
 
Back
Top