Expected Receipt Date - OnValidate() countLines:= 0; Item.SETRANGE("No.",Rec."No."); Item.SETRANGE("Location Filter",Rec."Location Code"); Item.FINDFIRST; Item.CALCFIELDS(Inventory); SalesOrderLine.SETRANGE("No.",Item."No."); SalesOrderLine.SETRANGE("Document Type",SalesOrderLine."Document Type"::Order); SalesOrderLine.SETRANGE(Type,SalesOrderLine.Type::Item); SalesOrderLine.SETRANGE("Location Code",Rec."Location Code"); SalesOrderLine.SETFILTER("Outstanding Quantity",'>=0'); SalesOrderLine.SETCURRENTKEY("Document Type",Type,"No.","Variant Code","Drop Shipment","Location Code","Shipment Date"); SalesOrderLine.ASCENDING(TRUE); IF SalesOrderLine.FIND('-') THEN BEGIN REPEAT SalesOrderLine."Shipment Date" := Rec."Expected Receipt Date" +1; SalesOrderLine.MODIFY; countLines += 1; UNTIL SalesOrderLine.NEXT = 0; END; MESSAGE(FORMAT(countLines));
This is my code for page 54 Purchase Order Subform, I want to change the date with the filters above.
When I have the code where it changes the date and the modify - It only changes 1 record.
If i comment those 2 lines out, the counter will message out 4 - which is the correct.
SalesOrderLine."Shipment Date" := Rec."Expected Receipt Date" +1; SalesOrderLine.MODIFY;
*This post is locked for comments