field("Code Client"; "Code Client") { CaptionML = FRB = 'Code client'; trigger OnValidate(); var locContrat : Record Contrat; locContratDetail : Record "Contrat Detail"; begin locContrat.Reset; locContrat.SetRange("Code Client","Code Client"); locContrat.SetCurrentKey("No."); if locContrat.FindLast then Validate("No. Contrat",locContrat."No."); Message ('%1 : Contrat No = %2',locContrat.FindLast,locContrat."No."); // show "YES" and the correct value of "No. Contrat" CurrPage.Update(true); end; }
Answers
try to move code to onValidate trigger in table
Thank you for your quick reply.
It didn't change anything.
(sorry i didn't know your answer will be colored in red )
Validate("No. Contrat",locContrat."No."); --> "No. Contrat" := locContrat."No.";
If it will be ok - error in inValidate trigger on field "No. Contrat"
hi try modify Rec, not locContrat
Message ('%1',"No. Contrat");
Or use Debuger to evaluate value of Rec."No. Contrat" after VALIDATE