code equivalent of look up

hi all how to write the code equivalent of the look up and the table relation prop of the table

Hi Kumar, try this: CLEAR(Frm); Frm.LOOKUPMODE(TRUE); IF Frm.RUNMODAL = ACTION::LookupOK THEN Frm.GETRECORD(Rec); Use Frm.SETRECORD(Rec) to start the form with a certain record. Kumar, the solution of this problem can be found in numerous places throughout the forum. Good luck, Bartel W. de Leeuw

Hi, another way to do it is:

  Field := RecordOfField.Field;

pay attention to the zero in RUNMODAL(0, RecordOfField), this will open the default lookup-screen of the record. Greetings, Reijer

Originally posted by MVGS: Hi thanks Bartel and Reijer but my actual problem is i have a table and field say ‘number’ which looks up into its own table but is not a part of PK, so when the user looks up using this field and selects the number that value should be updated into the form …how do i go about this… thanks in adv kumar

Kumar, I’m afraid I miss your problem. The last codeline of Reijer’s text can change the field in your current form. Do you need a CURRFORM.UPDATE? What do you mean when you say that your field is not a part of PK? Maybe attach your form, so we can check out the problem? Good luck, Bartel W. de Leeuw

If I understand your problem correctly you can still use the method Reijer mentioned. When you look up to the form and select a record, that record will be passed back. At this point you have the record of choice. You can take whatever field you want from that record(i.e the number field) irrrespective of the primary key. //want to return a value from SomeRecord that is not part of it’s PK IF FORM.RUNMODAL(0, SomeRecord) = ACTION::LookupOK THEN BEGIN anyfield1 := SomeRecord.anyField1;//(Not part of the PK) anyfield2 := SomeRecord.anyField2;//(Not part of the PK) END; The WHOLE record is returned when you choose it. You could take any field you want from that record. Assuming that we understand your problem of course. Taylor McCartney Development Specialist CSB Systems

What is the reason you want to do it with code? Perhaps it can be done without it. Just fill the Field property in your TableRelation. (And the LookupFormID in the properties of the table).

I’m looking for LookupFormID in table properties but in vain. Can anyone show me how I can see the LookupFormID property in table? Thanks in advance.

Hi open the table in design mode, go to the empty line next to the last field of the table, place the cursor there and then go to View- Properties…in this properties sheet u will find the ‘Lookup Form id’ property.Infact it is the 10th row in the properties. kumar