There is a custom field which is linked to a table. Lets assume this field is filled currently with data XYZ. If I lookup this field and it takes me to the list its linked to.there if I press escape the data XYZ in the field become empty.
If possible use properties only (TableRelation, LookupFormID)
Next, try to implement it in the field's OnLookup trigger (on the table). Here you assign the value to the field without validating it. Validation happens later when you leave the field.
In the textbox cortrol's OnLookup trigger (on the form). Here you assign the value to the Text parameter of the trigger and return TRUE or FALSE depending on whether you want the returned value to be used or ignored. You do not use the value of the control's SourceExpr (the field or variable) at all.
If you use any OnLookup trigger, it is the responsibility of your code to check the return value of the call to the lookup form to check for abortion and process this condition accordingly. Usually you will do:
On a control (Code in the Form object)
IF Form.RUNMODAL(...)=ACTION::LookupOK THEN
... // assign the resulting value to Text and return TRUE
ELSE
...; // cleanup and return FALSE
On a field (Code in the Table object)
// make sure the field's value does not get changed unless
// your lookup returned a value the user intended to use
IF Form.RUNMODAL(...)=ACTION::LookupOK THEN
...; // assign the resulting value to the field
Comments
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
If you use any OnLookup trigger, it is the responsibility of your code to check the return value of the call to the lookup form to check for abortion and process this condition accordingly. Usually you will do:
On a control (Code in the Form object) On a field (Code in the Table object)