How to update a temporary table used in a form?

hazemhazem Member Posts: 187
Hello everybody,
i have a form in which i use a temporary table. The first time the user push a button in the form, some records are inserted into this temporary table. When he push the button again i puted a function to delete all the records previously inserted to insert the new one; They are deleted but still got a message telling me that the record already exist when the insert process begin. I think it's an update problem but how to solve it?How to update a temporary table? :-k

Answers

  • David_CoxDavid_Cox Member Posts: 509
    You could Try
    TempRec.DELETEALL;
    SELECTLATESTVERSION;
    TempRec.RESET;
    TempRec.INIT;

    If that don't work then
    IF NOT TempRec.INSERT THEN
    TempRec.MODIFY;

    Running a form on a temporary table, you might also try using two temporary tables, so you are not deleting the displayed records, only replacing them.

    Run your Code on TempRec2 then
    TempRec := TempRec2;
    CURRFORM.UPDATE(FALSE);
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • hazemhazem Member Posts: 187
    I tried this:

    TempRec := TempRec2;
    CURRFORM.UPDATE(FALSE);


    but that doesn't work!!!! :? What should i do?
  • ara3nara3n Member Posts: 9,257
    before deleting make sure you do a reset.

    TempRec.reset;

    TempRec.DELETEALL;
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.