This is sample codes to do lookup to Customer List form and put the lookup value to field "TableField"
TableField - OnLookup (VAR Text : Text[1024;) : Boolean
Method 1:
CLEAR(CustForm);
CustTable."No." := Text;
CustTable.SETRANGE("No.",'10000','50000');
CustForm.SETTABLEVIEW(CustTable);
CustForm.SETRECORD(CustTable);
CustForm.LOOKUPMODE(TRUE);
IF CustForm.RUNMODAL = ACTION::LookupOK THEN BEGIN
CustForm.GETRECORD(CustTable);
TableField := CustTable."No.";
END;
Method 2:
CustTable."No." := Text;
CustTable.SETRANGE("No.",'10000','50000');
IF FORM.RUNMODAL(0,CustTable) = ACTION::LookupOK THEN
"Test Lookup" := CustTable."No.";
Method 3:
CustTable."No." := Text;
CustTable.SETRANGE("No.",'10000','50000');
IF FORM.RUNMODAL(0,CustTable) = ACTION::LookupOK THEN BEGIN
Text := CustTable."No.";
EXIT(TRUE);
END;
No comments:
Post a Comment