m.lcReplace = "" FOR m.lnCount = 1 TO FCOUNT(m.cCursorName) m.lcFieldName = FIELD(m.lnCount,m.cCursorName) m.lcReplace = m.lcReplace + m.lcFieldName + " WITH " + ; + m.cCursorName + "." + m.lcFieldName + "," ENDFOR m.lnCount *Drop the last comma. m.lcReplace = LEFT(m.lcReplace,LEN(m.lcReplace)-1) SET ORDER TO (m.cKeyField) IN (m.cCursorName) SELECT (m.cTableName) SET RELATION TO (m.cKeyField) INTO (m.cCursorName) REPLACE ALL &lcReplace. IN (cTableName)The code you have is replacing one field at a time per locate inside a scan. SET RELATION keeps the two tables in synch. REPLACE ALL does the scan. &lcReplace specifies the source and target fields.