A RecRef variable can be opened with an optional parameter called CompanyName
RecordRef.OPEN(No[, Temp][, CompanyName])
NAV help for this function says: If you use the CompanyName parameter, then this function works the same as the CHANGECOMPANY Function (Record).
I'm using this on my code, but RecRef always points to the current company.
IF Company.FINDSET THEN
REPEAT
T3.INIT;
T3.Code := COPYSTR(Company.Name,1,10);
RecRef2.GETTABLE(T3);
RecRef.OPEN(3,FALSE,Company.Name);
RecRef := RecRef2;
RecRef.INSERT;
RecRef.CLOSE;
UNTIL Company.NEXT = 0;
Notice that this code is only for testing purposes. All records get inserted on the same company, instead of in different companies.
Has anyone experienced that?
I'm on NAV 2009 R2 (6.00.32012)
thanks
Answers
With this assignation, recref points to the same recref2 was pointing (including the company).
How can I assign the whole record from a RecRef to another one, and change the company afterwards, or copy just the values, or...
I tried
RecRef := RecRef2.DUPLICATE;
But not working