LookUp

I know this topic was described in this forum, but i couldn’t find it. So once again: In a form i want to provide a lookup. The result should be stored in a variable of the form. The property “LookUp” of the variable is set to “yes”, Property “LookUpFormID” shows to the required form. But this doesn’t help. I guess i need to code something in the trigger “OnLookUp”, but i don’t know how to make the system open the lookup form and filling the variable with the value of the field. thanks in advance

One way: Rec := SourceTable of original form RecVar := SourceTable of Lookup Form FormVar := Lookup Form IF FormVar.RUNMODAL = ACTION::LookupOK THEN BEGIN FormVar.GETRECORD(RecVar); Rec.Field := RecVar.Field; END; hope that helps

You needn’t define LookUp and LookUpFormID properties or code anything. Enough is define “Table Relation” to valid table (in this table has to be LookupFormID property defined, if isn’t define LookupFormID on form). Jozef Kovac

@Tirex: unfortunately there is no lookup form selected at the source-table @Kbara: when i use FormVar.RUNMODAL then is no “ok”-Button offered at the lookup form and i have no possibility to select an entry. If i use FORM.RUNMODAL(number) then there is offered a “ok”-button, but i can’t get the value, although i used your script…

Yeah, sorry, I forgot: On the lookup Form, put an OK button with the following property settings: PushAction: LookupOK InvalidActionAppearance: Hide The second one will stop the button from showing when the form is accessed normally. Regarding what Tirex said, I’m not guaranteeing that I’m giving you the esaiest / best way here - just one method.

Hi Stefan on the trigger “onlookup” of control on the form assign the value into the local variable “text” belonging to the “onlookup” trigger. and then assign into a variable declared on the form. hope this helps MK

@Kristian: the lookup form has to buttons: an exit-button and an ok-button. The properties are set as you mentioned. Nevertheless the buttons are not shown when i provide a lookup @MK: hmmm… i’ve never used a trigger with a aparameter in a form. How can i transfer a variable to this kind of trigger and how can i assign the value of the trigger to another variable ?

well, as mentioned in a related post…[;)] I usually use the following statement: IF FORM.RUNMODAL(FORM::“Contact List”,ContPers) = ACTION::LookupOK THEN… and ContPers then contains the selected record. Copy the “ok” and “Cancel” button from any other form and it’ll work. Saludos Nils

it lastet long, but finally i made it. thanks to all and your patience