Lookup to another company

Hi, I’m trying to write a lookup that’ll lookup to another company’s purchase order. Here’s what I have so far: PurchHeader2.CHANGECOMPANY(‘New company’); PurchHeader2.SETRANGE(“Document Type”,PurchHeader2.“Document Type”::Order); CLEAR(PurchList); PurchList.SETTABLEVIEW(PurchHeader2); PurchList.SETRECORD(PurchHeader2); PurchList.LOOKUPMODE(TRUE); IF PurchList.RUNMODAL = ACTION::LookupOK THEN BEGIN PurchList.GETRECORD(PurchHeader2); PONumber := PurchHeader2.“No.”; END; PurchHeader2 = Purchase Header table PurchList = Purchase List form This doesn’t seem to work as it keeps looking up to the current company’s purchase orders. Can someone help me? Thanks!

Hi, Create a function in your form PurchList looking like this: ChangeToCompany(CompanyName : Text[30]) CHANGECOMPANY(CompanyName);and call it like this:...code as above CLEAR(PurchList); PurchList.ChangeToCompany('New Company'); PurchList.SETTABLEVIEW(PurchHeader2); ...code as above

quote:


Originally posted by Steffen Voel
Hi, Create a function in your form PurchList looking like this: ChangeToCompany(CompanyName : Text[30]) CHANGECOMPANY(CompanyName);and call it like this:...code as above CLEAR(PurchList); PurchList.ChangeToCompany('New Company'); PurchList.SETTABLEVIEW(PurchHeader2); ...code as above


My goodness… You’re da man! Thank you!