Hi Jim,
>
>Here's a WHERE that works
>
>WHERE Detail.avr_wtg = .T.
>
>The Having clause is not necessary and it is even NOT recommended since the issue can be resolved against the source table.
>
>>This will cause a data-type mismatch. If he's testing against the result of the iif(), he's got to use the HAVING clause.
Absolutely agree! All I was saying was that the WHERE clause you first posted would cause a data-type mismatch, since you had coded it against the result of the iif(), not the logical table value.
I only posted the HAVING option because IF (and only IF) the result needed to be queried (NOT in the posted case <G>) HAVING would solve it.
Bill Armbrecht
VFP MCP