two lookups on a form

Hi, I create a form with two text boxes in the first one I want to look for all the organizations stored in table 5050, so I used the table relation: Contact.No. WHERE (Type=CONST(Company)) In the seconrd text box I want to have a lookup for all contacts belonging to the company, which I selected in the first field. But this is creating problems, I stored the Company No in a global variable, but the second field does not allow a table relation. Contact.No. WHERE (Type=CONST(Person),“Company No.”=CONST(“OrdId”)) If I do this than the second lookup will give an empty table and if you look into the Table filter you will see Company No. ORGID Type Person So instead of using the value of the variable, the name of the variable is used in the filter. Can someone help me with this? Thank you very much. Best regards, R.J. van Kuppeveld

If these fields aren’t on the source table you could code the second lookup in code like this: ContactRec.SETRANGE(“Company No.”, OrdId); ContactRec.SETRANGE(“Type”, ‘Person’); ContactForm.SETTABLEVIEW(ContactRec); ContactForm.LOOKUPMODE(True); IF ContactForm.RUNMODAL = ACTION::LookupOk THEN BEGIN ContactForm.GETRECORD(ContactRec); secondfieldsource := ContactRec.“No.”; //set the source of the second field to that of the contact selected END ELSE secondfieldsource:= ‘’; //Clear the field if the lookup was cancelled This code is off the top of my head so excuse any mistypes etc. Hope it helps.

Thank you very much for your help Best regards, R.J. van Kuppeveld