Hi Sytze: You can't use _tally this way. You are assuming too much using like this, and this system variable is updated with every VFP command that operates on records, as Select-SQL, REPLACE, UPDATE, and the like. In your example, _tally is updated *after* REPLACE is executed with the number of records affected, but can be affected also with the Select-SQL at the same time.
You didn't mention what the error is, but you can't use a Select-SQL as a function or expression, because it is a command. You should decompose this, may be using this Select-SQL inside a function, but the _tally behaviour can be erratic in this use case. Best regards.- 2014-07-30 0:22 GMT+02:00 Sytze de Boer <sytze.k...@gmail.com>: > Friends > Can someone point out me error here please > > select stocktable > REPLACE ALL qty WITH IIF(_tally>0,select SUM(qty) as ttl,stockcode FROM > invtable where stockcode=stocktable.code,ttl,0)) > > -- > Kind regards, > Sytze de Boer > Kiss Software > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- kept) > text/html > --- > [excessive quoting removed by server] _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAGQ_Jum=e6q-ga6txjzu0r9wgj-i0vu9qwhd7y0epv3shpa...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.