Options

how to change a record in use with code?

ntnt Member Posts: 160
hi, any one knows how can i change a record that is in use.

thanks.

Comments

  • Options
    nvgnvg Member Posts: 25
    Elaborate please with an example as to what do u want to modify in a record.

    I hope that ur problem is much more complicated then what u have written. Changing a record is fundamental operation of Navision like inserting, searching or deleting.

    Regards,
    NVG
  • Options
    kinekine Member Posts: 12,562
    If you mean change record, which is locked by another user, you are not able to do that... if you mean something other, please, post more details about your goal...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    ntnt Member Posts: 160
    for example: when i'm trying to insert a new customer, in the validate of a field, i got to verify a thing and i got to open other form list, and then i got to modify a field in the card form that is already open, but when i return to the card form i got the error that say that another user has change the table.........

    any idea?
  • Options
    kinekine Member Posts: 12,562
    after return from the form, you must re-read all variables which are on selected record.

    wrong
       A.GET(PrimKey1);
       FORM.RUNMODAL(...);
           //A with PrimKey1 is changed
       A.Field10 := value;
       A.MODIFY;   //Error that another user changed...
    

    correct
       FORM.RUNMODAL(...);
           //record from table A with PrimKey1 is changed
       A.GET(PrimKey1);
       A.Field10 := value;
       A.MODIFY;
    

    A can be Rec for example in OnValidate trigger...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    ntnt Member Posts: 160
    ok thanks ;)
Sign In or Register to comment.