SCAN lcTable = DataDict.TableName select DataDict lcFields = "INSERT INTO "+lcTable+" (" lcValues = "Values(" lcComma = '' * seems to me that this should be scan for scan while TableName = m.lcTable lcFields = lcFields + lcComma + CRLF + alltrim(FieldName) lcValues = lcValues + lcComma + CRLF + '?poRow.' + alltrim(FieldName) lcComma = ', ' ENDSCAN lcInser = lcFields + ') '+CRLF + lcValues +')' PRIVATE poRow * shouldn't there be a select data tabel here? SCAN FOR tablename = m.lcTable && not sure what condition this should be SCATTER NAME poRow sqlexec(hCon, m.lcInser) ENDSCAN endtext lcTable = DataDict.tableName endscan>>>I agree with everything you are saying. And just for the heck of it (even though VFP does not recommend) I will try to use TEXTMERGE within TEXTMERGE just to see what comes out. Stay tuned.
>> lcTable = DataDict.TableName >> >>select DataDict >> >> scan while TableName = m.lcTable >> lcFields = lcFields + IIF(empty(m.lcFields,'') + ', ' + CRLF + alltrim(FieldName) >> lcValues = lcValues + IIF(empty(m.lcValues,'') + ', ' + CRLF + '?' + m.lcTable + '. ' + alltrim(FieldName) >> endscan >> text to lcPRG additive textmerge noshow >> text to lcInsert noshow >> INSERT INTO <<m.lcTable>> ( >> <<m.lcFields>> >> ) >> VALUES ( >> <<m.lcValues>> >> ) >> endtext >> SCAN <<m.lcTable>> >> >> sqlexec(hCon, m.lcInser) >> ENDSCAN >> endtext >> lcTable = DataDict.tableName >>endscan>>