Hi You need to call the clear() method on the SalesTable buffer variable before you call the code to change company.
Regards Malcolm Burtt Product Development Manager Touchstone ________________________________ From: [email protected] [EMAIL PROTECTED] On Behalf Of eldj_joax [EMAIL PROTECTED] Sent: 14 October 2008 18:50 To: [email protected] Subject: [development-axapta] switching companies in Axapta with X++ - Error I am trying to switch between companies for a special report in AX 4.0 SP2. I try to change to one of the 12 companies. I am able to change with the first 2 companies, but with the third one, for some reason, I am getting the following error information: Unable to change company for Sales orders (SalesTable). The buffer contains a record which has been selected from the original company. The company "ID" I am using to change companies is fetched from the table VirtualDataAreaList so I am sure it is part of a virtual company and also a valid CompanyID. Help please!

