wont set one field!

nvermanverma Member Posts: 396
Could someone look at the following code and tell me what I am doing wrong. The line that has a bunch of stars with them, it wont execute it. It pulls the correct FA Class code and it sets the correct no. of depreciation year in the depreciation book form, but it wont set the correct depreciation method field. Any idea why???

This code is written in OnValidate trigger (FA class code)
FA.GET("No.");
FADeprBook.SETRANGE("FA No.", FA."No.");
FASetup.GET;
//FAClass.GET;

IF FADeprBook.FINDSET THEN 
  IF FASetup."Default Depr. Book" <> '' THEN
  BEGIN
    FADeprBook.SETRANGE("Depreciation Book Code", FASetup."Default Depr. Book");
    IF FADeprBook.FINDFIRST = TRUE THEN

    IF xRec."FA Class Code" = '' THEN
    BEGIN
        FADeprBook."FA Posting Group" := Rec."FA Class Code";
        FAClass.SETFILTER(Code, Rec."FA Class Code");
         IF FAClass.FINDSET THEN
         REPEAT

           FADeprBook."No. of Depreciation Years" := FAClass."Default Years"; //  WORKS Perfectly
           FADeprBook."Depreciation Method" := FAClass."Default Method"; //************* DOES NOT WORK
         UNTIL FAClass.NEXT = 0;
    END
    ELSE
      IF CONFIRM ('Do you want to change the FA Posting Group on Depreciation Book %1?', TRUE, FASetup."Default Depr. Book") THEN
      BEGIN
         FADeprBook."FA Posting Group" := Rec."FA Class Code";
         FAClass.SETFILTER(Code, Rec."FA Class Code");
         IF FAClass.FINDSET THEN
         REPEAT

             FADeprBook."No. of Depreciation Years" := FAClass."Default Years";   //  WORKS Perfectly
             FADeprBook."Depreciation Method" := FAClass."Default Method"; //************* DOES NOT work. 
         UNTIL FAClass.NEXT = 0;
      END
      ELSE
        Rec."FA Class Code" := xRec."FA Class Code";
  END;

FADeprBook.MODIFY;


FAClass.Depreciation method is an option field and FADerpBook."Depreciation Method" is also an option field.

Answers

Sign In or Register to comment.