Changecompany Once Again

Hello, Im having a problem using the Changecompany, well Im trying to display the records of CompanyB in CompanyA. Using a List Form. Here it is. while in CompanyA → Record.changecompany(‘CompanyB’); Form.Settableview(Record); Form.runmodal; well this seems to be ok but it still displays the records of ‘CompanyA’ any ideas !!! Thanx a ton guys…

[?] Have you tried it with a GET or FIND? e.g.

Record.CHANGECOMPANY(<Company 2>);
Record.GET(<PrimaryKey>);  // Record.FIND('-');
FORM.RUNMODAL(FORM::Form, Record);

Regards, Jörg

Thanx styyk, Ya I did try it with find, doesnt work. For eg. if I want to diplay all the records of the Currency Table of CompanyA in CompanyB, so I dont think i can use Get aint it ?

Could it be that SETTABLEVIEW only copies the filters and current key from the source record to the form view without actually using the record variable itself, therefore ignoring the company setting? Have you tried to call CHANGECOMPANY in OnInit or OnOpenForm of the form you are about to open?

[?][?][?] I tried this code:

Item.CHANGECOMPANY('Test');
FORM.RUNMODAL(FORM::"Item List", Item);

It works !!! This code

Item.CHANGECOMPANY('Test');
ItemList.SETTABLEVIEW(Item);
ItemList.RUNMODAL;

does not work !!! So I think - as Heinz supposed - that CHANGECOMPANY will not work with a SETTABLEVIEW, or if you call a Form as a variable! Regards, Jörg

Yo !!! thats cool Thanx a ton xorph…this works just fine… Thanx to everyone who helped to, i appreciate the gesture. This place is just amazing Cheers, [;)] Vishal

Joerg, I think the magic lies in passing the record variable to RUNMODAL, independent of the way you are accessing the form (name or variable). [;)]

quote:


Originally posted by vshal
This place is just amazing


Yeah, I agree wholeheartedly - this forum literally has saved me from hours of tedious work and frustration and has given me tons of new insights [8D] Kudos to Erik for having created this place and doing a great job keeping it up and running!

SETTABLEVIEW is just a mthod of passing filters from one record to another. What you must do here is pass the record, not the filters.