>Hi,
>
>Has anybody seen something like this?
>
>
>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.
>
>I'm running 5 with sp3 installed.
>
>TIA,
>
>Marc
When the price field is created in the cursor it gets its size based on the result of the first record, so an overflow problem could ensure if the first record returns a zero and a single digit field is created. You might want to try this: 0000.0000 + iif(V_Weight=0,0,v_Value/v_weight) as price