lookup and validate

i have written code equivalent for lookup on a field, but when i write anything on the validate trigger of the field, it is not being executed. thanks in advance kumar

hi Kumar, the validation-trigger is not executed until the user presses Return, of moves to another field in your form. So to execute the validation-trigger, select a value with your lookup, and then press enter. Good luck, Bartel W. de Leeuw

Bartel - That is only half of the truth. If you do the code on a form, the OnValidate and OnAfterValidate will not be execuded unless, you tell it to. OnLookup(VAR Text : Text[260]:wink: : Boolean As You see, the OnLookup (on the form) has a parameter, and a returnvalue. Normally I see people do something in this direction:


OnLookup(VAR Text : Text[260];) : Boolean

Customer.SETRANGE(Blocked,FLASE);
if form.runmodal(0,Customer) = ACTION::Lookupok then
  "Customer No." := Customer."No.";

this will not run the OnValidate on the form. This is how I normally do it:


OnLookup(VAR Text : Text[260];) : Boolean

Customer.SETRANGE(Blocked,FLASE);
if form.runmodal(0,Customer) = ACTION::Lookupok then begin
  **Text** := Customer."No.";
  exit(true);
end else
  exit(false);

This WILL execute the OnValudate of the FORM. //Henrik Helgesen [size=1]-: KISS::Keep it Si Edited by - hhelgesen on 2001 Nov 16 21:52:56

Thanks Henrik its working fine now. kumar