Release/commit a table programatically

arindamarindam Member Posts: 176
Hi All,


I have 2 cases,
1) I have assigned a variable for say sales header table as recSalesHead in a form.

2) In another form Sales Header table is assigned to the form's source table.

Now I am updating the table in case 1 -

..
..
..
Insert;
Commit;

For case 2 what should i use to commit the updation to the table. Presently I am using -
..
..
..
recSalesHead.Insert;
recSalesHead.reset;

I am using case 1 in a function of a code unit. After performing this task when I am trying to update Sales Header table (in case 2) at my form, it is giving an error -

"Another user has modified the record for this Sales Header after you retrieved it from the database.
Enter your changes again in the updated window, or start the interrupted activity again.
Identification feilds and values:
Document Type='Order',No.='1009' "

Please advice.
Thanks
Arindam

Comments

  • kinekine Member Posts: 12,562
    I am not sure if your description is clear enough to understand your problem... but if you are modifying same record from two points in code, why you are using INSERT in second case when the record was already inserted in first case?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DaveTDaveT Member Posts: 1,039
    Hi Arindam,

    If I understand you correctly - to commit the second case is just to you issue the commit statement i.e. the insert function is record (table) specific but commit is for the database. What is throwing you off is that if you issue the insert command on it's only it is assuming the Rec record (Sales Header in your case).

    Look up the two functions in the C/Side Reference Guide for more info.

    Hope this helps
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.