MB Software Solutions General Account wrote: > Kevin Cully wrote: >> Just to tack on some more Foxpro talk, I prefer to use the SCATTER NAME >> / INSERT FROM NAME methodology, as a way of getting away from APPEND >> BLANK. If the GATHER fails for whatever reason, many times you're left >> with a record that blocks the next APPEND BLANK. >> >> SELECT table2 >> SCATTER NAME loMyRecord FIELDS EXCEPT Voucher >> INSERT INTO table1 FROM NAME loMyRecord >> >> If the INSERT fails, it won't leave a partial record in the table the >> way the APPEND BLANK would. And just a little bit better: >> >> SELECT table2 >> SCATTER NAME loMyRecord FIELDS EXCEPT Voucher >> TRY >> INSERT INTO table1 FROM NAME loMyRecord >> CATCH >> && Something bad happened. >> THIS.lError = .T. >> THIS.cErrorMsg = [Failed trying to insert a record into table1.] >> && More error handling can go here too. >> ENDTRY > > Ditto. It's also better (imo) for indexes too, as the APPEND BLANK > updates the index(es), then the GATHER updates the index(es) too.
To clarify, it'd be best to do INSERT INTO FROM NAME for updating the indexes ONCE instead of for each update. I say that after re-reading my notes in code. _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** 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.

