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


-Kevin
CULLY Technologies, LLC


MB Software Solutions General Account wrote:
> Sytze de Boer wrote:
>> Hi
>> Thanks for this, but would that not throw another error since that
>> table does not have a field called Voucher
> 
> 
> No...since it basically prevents your code from trying to affect the
> autoinc field.  I use GATHER with the FIELDS EXCEPT code in my n-tier
> framework all the time.
> 
> 
> 
> 
[excessive quoting removed by server]

_______________________________________________
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.

Reply via email to