>Marc,
>
>Does the result vary based on what is the first record of the cursor? SQL sizes the column based on the first row. So change the iif() to iif(v_weight=0,000.0000, v_value/v_weight). Use whatever field size/decimals as appropriate for your data.
>
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 :)
Marc
>>
>>select virtual.*, iif(V_Weight=0,0,v_Value/v_weight) as price;
>> from Virtual,Stock,Sale;
>> where stk_Parcel=V_Stock;
>> and sal_Docnr= stk_docnr;
>> and V_Box= cKey;
>> and V_Status= hStk_Sale;
>> into cursor glSold
>>
>>
>>This works 1) when I open the files and executed it in the command window. 2) from the program if I leave out the iif statement, and 3) it worked yesterday :).
>>
>>It does not work from the program if I leave out the as price clause or change price into something else. And not only that it does not work, the sql makes vfp go south.
>>
>>The same happens with a similar sql but with other files.
If things have the tendency to go your way, do not worry. It won't last. Jules Renard.