Marc,
I wonder if the SQL engine is getting an untrapped divide by zero? What if you used a UDF instead of the iif()?
>Thanks David. I did do that, but to no avail. The strange thing is not so much that the sql give an error, but the VFP goes south. Must have done something really naughty :)