How to make a lookupform and return the value

From a customercard we would like to make a lookup on an item survey-form. From the item-form we want to return the itemnumber to the customercard. Any takers?

Make the field in the customer table have a table relation to the item table, then it should be okay. Lars Strøm Valsted Head of Project and Analysis Columbus IT Partner A/S www.columbusitpartner.com

Hi! You could also define the survey-form as a variable and then use the GETRECORD-function when calling the form by code. Example: Globals ItemForm Form31 ItemRec Table27 Trigger() CLEAR(ItemForm); ItemForm.LOOKUPMODE(TRUE); IF (ItemForm.RUNMODAL = Action::LookupOk) THEN ItemForm.GETRECORD(ItemRec); Now you could evaluate the Item-record as you wish! Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP

Hi Kentt, I agree with Lars Strøm Valsted. Create a table relationship to the new table. If you have not done so, you will also need to add the LookupFormID property to reflect the form you are using for lookup. Once you have done these 2 things, Navision will do the field validation and Lookup functionality for you. Have a nice day! Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

quote:


ItemForm.LOOKUPMODE(TRUE); IF (ItemForm.RUNMODAL = Action::LookupOk) THEN ItemForm.GETRECORD(ItemRec);


Did you try that? I would be surprised if this would work as at the moment “ItemForm.GETRECORD” is called the ItemForm is already closed!? What about a simple


myItemRec.Setrange(blabla ...);
If Form.RunModal(Form::"ItemForm", myItemRec) = ACTION::LookupOk then
  Validate (ItemNo, myItemRec.Number);

------- With best regards from Switzerland Marcus Fabian

As an example that definitely works: OldProdGroup:=“Product Group”; ProdGrouping.RESET; ProdGrouping.SETRANGE(Class,“Gen. Prod. Posting Group”); CLEAR(ProdGroupLookup); ProdGroupLookup.SETTABLEVIEW(ProdGrouping); IF ProdGroupLookup.RUNMODAL = ACTION::LookupOK THEN BEGIN ProdGroupLookup.GETRECORD(ProdGrouping); “Product Group”:=ProdGrouping.“Group Code”; IF OldProdGroup<>“Product Group” THEN BEGIN //… some code here … END; END; If the form doesnt have LOOKUPMODE=TRUE in its properties then you can set it via code before the form is run. Craig Bradney Technical Manager Navision Solutions & Services, Deloitte Touche Tohmatsu Email:cbradney@deloitte.com.au

quote:


Originally posted by fabian:

quote:


ItemForm.LOOKUPMODE(TRUE); IF (ItemForm.RUNMODAL = Action::LookupOk) THEN ItemForm.GETRECORD(ItemRec);


Did you try that? I would be surprised if this would work as at the moment “ItemForm.GETRECORD” is called the ItemForm is already closed!?


Form is closed, but it still in memory. It cleared after CLEAR(…) or closing calling form. This method is more accetable, then you need call func. in lookup form before or after lookuping.