Hello good people. i have ans issue here.
i have created two custom tables. A journal line table and and an entry table with corresponding forms.
i use journal line form to make entries which i want to post to the entry table when i press a button with code on the onpush trigger.
The erro i get is “Drug Update journal cannot close because the system is currently working”. when i say ok the error that pops says "Drug Register Entry Entry No’0’ already exists. Entry No. is primary key in entry table. below is my code.
RegLine.INIT;
IF RegLine.FIND(’-’) THEN BEGIN
REPEAT
DrugEntry.“Journal Batch name” :=RegLine.“Journal Batch name”;
DrugEntry.“Reg No.”:=RegLine.“Reg No.”;
DrugEntry.“Drug name”:=RegLine.“Drug name”;
DrugEntry.“Generic Name”:=RegLine.“Generic Name”;
DrugEntry.“Date of Update”:=RegLine.“Date of Update”;
DrugEntry.“Reason/Comment for Update”:=RegLine.“Reason/Comment for Update”;
DrugEntry.LHolder:=RegLine.“LHolder No.”;
DrugEntry.“Pack Size”:=RegLine.“Pack Size”;
DrugEntry.“Updated By”:=USERID;
DrugEntry.“Licence No.”:=RegLine.“Licence No.”;
DrugEntry.“ATC Code”:=RegLine.“ATC Code”;
DrugEntry.“LTR No.”:=RegLine.“LTR No.”;
DrugEntry.LHolder:=RegLine.“LHolder No.”;
DrugEntry.“Shelf Life”:=RegLine.“Shelf Life”;
DrugEntry.Strength:=RegLine.Strength;
DrugEntry.“Product Status” := RegLine.“New Status”;
DrugEntry.INSERT;
// To flag the register
IF Drug.GET(RegLine.“Reg No.”) THEN BEGIN
Drug.“Reason/Explanation”:=RegLine.“Reason/Comment for Update”;
Drug.“Date of Update”:=RegLine.“Date of Update”;
Drug.Updated:=TRUE;
Drug.“Updated By”:=USERID;
Drug.“Product Status”:=RegLine.“New Status”;
Drug.MODIFY;
END;
UNTIL RegLine.NEXT=0;
END;
I’ll appreciate your help