lookup on a field deletes the current data in that field

lavanyaballurgilavanyaballurgi Member Posts: 235
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.

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Are you sure you didnot have any code in Onlookup trigger of field in both table and form/page?
  • vaprogvaprog Member Posts: 1,141
    • 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
    
Sign In or Register to comment.