>>Select Subledger >>Go Top >>Scan While .Not. Eof() >>If Left(Vrno,2)=="J-" >>Alldata_Vrno=Vrno >>Select Journal >>Locate For Vrno==Alldata_Vrno >>If Found()=.T. >>SumNaration=Naration1+Naration2+Naration3+Naration4+Naration5 >>Endif >>Select Subledger >>Replace Details With SumNaration >>Endif >>ENDSCAN >>>>
>update SubLedger >set Details = J.Naration1 + J.Naration2 + J.Naration3 + J.Naration4 + J.Naration5 >from SubLedger INNER JOIN Journal J ON SubLedger.Vrno = J.Vrno >WHERE SubLedger.Vrno LIKE 'J-%'BTW, in your original code what is supposed to happen when the match is not found? It looks like it was updating the details with previous row matching data. I think that was most likely a mistake, that's why I used inner join. If there is no match, no update will be done.