That second WHEN should be OR I think.
>The problem now is that SQL doesn't seem to like the 'AND' in the second CASE line.
>
>CASE tr.sTrans_Type_CD
> WHEN 'PR' THEN tr.decTrans_Qty
> WHEN ('PT' AND tr.decTrans_Qty > 0) THEN tr.decTrans_Qty
> ELSE 0
>END AS Receipt
>
>
>"Incorrect syntax near the keyword 'AND'."
>
>
>>>
>>>SQL doesn't like the 'OR's and 'AND's
>><snip>
>>T-SQL doesn't like '.' (dots) arround them. There's no need to use dots in VFP either.
>>
>>CASE WHEN (TRANCODE = 'PR') OR (TRANCODE = 'PT' AND TRANQUANT > 0) THEN TRANQUANT
>> ELSE 0 END AS Recepit
>>