>>I ran a test in VFP7 and VFP8 and don't see any difference between them.
>
>My function was run the number of times as per the number of records in Temp. It's just that it was being called even when the Type=2, which is wasn't suppose to.
Michel,
It wasn't called for type=2 but was called in the stage where VFP determines the size of the field. Looks like VFP evaluates both expressions in IIF() to get correct size of a field. Here's another test wich demonstartes that.
SELECT *, ;
PADR(IIF(1=1, "1", myudf("2",RECNO())),1) ;
FROM test
2 1
As you can see myudf shouldn't be ever executed but it is for record #1. And again I see the same result in VFP7 and 8.
--sb--