Hi Mike,
What is happening, is .NET is evaluating the false expression, even though the IIf statement is true. It will return the true result but if the false portion causes an error, the error will be thrown.
>I was getting the same error until I switched to a standard If statement as follows.
>
>MyEmailBody = myDataRow("AccountId") & " " & _
>myDataRow("OrderNumber")
>IF Not IsDBNull(myDataRow("APN")) THEN
> myDataRow &= " " & Trim(myDataRow("APN")))
>END IF
>IF Not IsDBNull(myDataRow("StreetNumber")) THEN
> myDataRow &= " " & Trim(myDataRow("StreetNumber")))
>END IF
>
>Not sure why the IIF acts the way it does - Would like to find out
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi