Hi I have this code on the OnValidate Function. With the Set ranges at the start once I find the production order, when i try to find the prod order component, using the recprodorder."No." it's coming up blank in the debugger. How can I ammend this to find the right production order component?
//FIND production Order
recProdOrder.RESET;
recProdOrder.SETRANGE("No.", "Source No.");
recProdOrder.SETRANGE("Item No.", "Item No.");
// Find Production Order Component for Production order
recProdOrderComponent.RESET;
recProdOrderComponent.SETRANGE("Prod. Order No.",recProdOrder."No.");//This isn't finding anything
// Check If Items found are Customer Specific
IF recProdOrderComponent.FINDFIRST THEN BEGIN
recProdOrderComponent.CALCFIELDS(FixedVariant);
IF recProdOrderComponent.FixedVariant THEN
ItemVariant.GET("Item No.","Variant Code");
//Check if variant is customer specific, and if it matches prod Order No.
IF ItemVariant.CALCFIELDS("Customer Specific") THEN
//Find the Production Order
recProdOrder.SETRANGE("No.", recProdOrderComponent."Prod. Order No.");
IF recProdOrder."Customer No." <> ItemVariant.Manufacturer THEN
ERROR(Text024);
END;
*This post is locked for comments