Hello,
I want to read out data from various tables from different companys by RecordRefs and RecordIDs,
For example: for company “A” I want to read Item 1000, for company “B” I want to read item 1001. So I wrote the RecordIDs of item 1000 and 1001 in a new table with “Data Per Company” = No
In a new Codeunit I am reading every Company in a loop. When I am logged on in company “A”, I get an error by a RecRef.GET of company “B”. What’s wrong with my sourcecode? I am using Version 4 SP1 with Build 21666 with Native Database.
Table OutputRecords with “Data Per Company” = No
Primary Key: Field 1+2
1 Companyname Text 30
2 Transaction No. BigInteger
3 RecordID RecordID
4 Table No Integer
Sourcecode:
Company.RESET;
IF Company.FIND(’-’) THEN
REPEAT
OutputRecords.RESET;
OutputRecords.SETCURRENTKEY(Companyname,“Table No”);
OutputRecords.SETRANGE(Companyname,Company.Name);
IF OutputRecords.FIND(’-’) THEN
REPEAT
RecRef.OPEN(OutputRecords.“Table No”,FALSE,Company.Name);
RecRef.GET(OutputRecords.RecordID); <----CAUSE AN ERROR for foreign Companies
UNTIL OutputRecords.NEXT = 0;
UNTIL Company.NEXT = 0;