View Single Post
  #1 (permalink)  
Old October 31st, 2003, 08:49 AM
fastcorvette fastcorvette is offline
Authorized User
Join Date: Oct 2003
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default IIF Statement Question

I am using the following SQL statement going against an Access database:

SELECT *, (Cost/PricePer) as MAmt FROM Table WHERE Num = @Num

Which works, however, PricePer can be zero so I have tried the following statement to check to see if PricePer is zero and if it is, I want MAmt to be zero:

SELECT *, IIF(PricePer > 0, (Cost/PricePer), 0) as MAmt FROM Table WHERE Num = @Num

The returning recordset has "#ERROR" in the MAmt field. What am I missing in this SQL statement?