RecSalesLines.RESET; RecSalesLines.SETRANGE("Document Type",RecSalesHeader."Document Type"); RecSalesLines.SETRANGE("Document No.",RecSalesHeader."No."); IF RecSalesLines.FIND('+') THEN LineNo:= RecSalesLines."Line No."; IF Famille<>Item."Family Code" THEN BEGIN RecSalesLines."Document Type" := RecSalesHeader."Document Type"; RecSalesLines."Document No." := RecSalesHeader."No."; RecSalesLines."Line No." := LineNo+50; RecSalesLines.VALIDATE(Type,0); RecSalesLines."No." :=''; RecSalesLines.Description := "Code Grande Famille"; RecSalesLines.INSERT; Family:=Item."Family Code"; END; RecSalesLines.INIT; RecSalesLines."Document Type" := RecSalesHeader."Document Type"; RecSalesLines."Document No." := RecSalesHeader."No."; LineNo := LineNo + 10000; RecSalesLines."Line No." := LineNo; RecSalesLines.Type := RecSalesLines.Type :: Item; RecSalesLines.VALIDATE("No.","No."); RecSalesLines.VALIDATE(Quantity,1); RecSalesLines.INSERT(TRUE);
The field No. of table Sales Line contains a value (DISQUE-AB) that cannot be found in the related table (Item).I checked the Item table, and I found an Item with a No. DISQUE-AB.
RecSalesLines.VALIDATE("No.","No.");What shall I do?
Answers
Infact, the problem was not in the code but in the item itself....