Dennis (and Ulises),
>I have had a similar problem. Add "SELECT TABLE1" just before "LOOP".<Well, that *may* solve that problem, but only because of the LOOP. You don't need a LOOP inside of a SCAN/ENDSCAN and in fact, I doubt if it will work correctly (that's most likely what the original problem was). In a SCAN/ENDSCAN, if you have selected another table somewhere in the code, when VFP hits the ENDSCAN to "go around again", it automatically selects the "driving" table. There is no need to do it in code.
~~Bonnie
>I have had a similar problem. Add "SELECT TABLE1" just before "LOOP".
>
>>Hi all.
>>I have a few lines of code like this:
>>SELECT TABLE1
>>GO TOP
>>xCOUNT=0
>>SCAN FOR OWE <> 0
>>STORE idSTD TO xidSTD
>>SELECT TABLE2
>>LOCATE FOR idSTD=xidSTD
>>REPLACE OWE WITH TABLE1.OWE
>>xCOUNT=xCOUNT+1
>>LOOP
>>EXIT
>>ENDSCAN
>>
>>Problem is it keeps going into an endless loop, without exiting when the last match is found. What am I missing?
>>
>>TIA
>>Ulises