Lookup Problem in Sales Line Table

IrishGiriIrishGiri Member Posts: 61
Hi all,

I have a field showing a vendor no. as part of every Sales Line record. I have programmed code in its On_Lookup trigger to open a form in which I have a filtered subset of records from another table from which to choose a vendor.

The problem is that when I select a record here and "OK" it to update/modify the vendor in the Sales Line, nothing happens.

Also I have to change the Lookup property of this lookup form to Yes because if I don't the OK and Cancel buttons don't appear????

Please help!!

Best regards,
:wink: Paul.

Answers

  • kapamaroukapamarou Member Posts: 1,152
    What have you written on the trigger?
  • canadian_baconcanadian_bacon Member Posts: 91
    You don't have to set the Lookup property of the form to yes. You can do this through code as well:
    SomeForm.LOOKUPMODE(TRUE);
    IF SomeForm.RUNMODAL IN [ACTION::Ok, ACTION::LookupOk] THEN BEGIN
      SomeForm.GETRECORD(SomeRecord);
      "Vendor No." := SomeRecord."No.";
    END;
    
  • kapamaroukapamarou Member Posts: 1,152
    Try:
    SomeForm.LOOKUPMODE(TRUE);
    SomeForm.SETTABLEVIEW(SomeRecord);
    SomeForm.SETRECORD(SomeRecord);
    IF SomeForm.RUNMODAL IN [ACTION::Ok, ACTION::LookupOk] THEN BEGIN
      SomeForm.GETRECORD(SomeRecord);
      "Vendor No." := SomeRecord."No.";
    END;
    
  • IrishGiriIrishGiri Member Posts: 61
    Thanks very much guys!

    The following code worked a treat :wink:
    xItemCost.SETRANGE(xItemCost."No.","No.");
    xItemCostForm.LOOKUPMODE(TRUE);
    xItemCostForm.SETTABLEVIEW(xItemCost);
    xItemCostForm.EDITABLE := FALSE;
    IF xItemCostForm.RUNMODAL IN [ACTION::OK, ACTION::LookupOK] THEN BEGIN
       xItemCostForm.GETRECORD(xItemCost);
       "Cód Proveedor" := xItemCost."Vendor No.";
    END;
    

    Best regards
Sign In or Register to comment.