sOldCompany := 'Company1'; sNewCompany := 'Company2'; CLEAR(rTables); rTables.SETRANGE("Tabellnr.", 3); rTables.FIND('-'); REPEAT CLEAR(rrRecordRef); rrRecordRef.OPEN(rTables."Tabellnr."); rrRecordRef.FIND('-'); REPEAT CLEAR(rrRecordRefNC); rrRecordRefNC.OPEN(rTables."Tabellnr.", FALSE, sNewCompany); rrRecordRefNC.INIT; rrRecordRefNC := rrRecordRef.DUPLICATE; rrRecordRefNC.INSERT; //Gets an error here... rrRecordRefNC.CLOSE; UNTIL rrRecordRef.NEXT = 0; rrRecordRef.CLOSE; UNTIL rTables.NEXT = 0;
Answers
You have to copy the fields 1 by 1.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Now I have added some code to loop trough the fields in the table and copying the values, but it still gives me the same error..
Am I missing something here?
I had forgotten to set a filter on Companyname on rTables, so it tried to insert into the same table more than once.. :whistle:
So I just added the line:
And then it works correct..
- Tbi
I was also trying to migrate data from one company to another using RecordReference but I wasn't succeeding, I even used the DUPLICATE function but then I couldn't move forward, but now I did. Thanks!