Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Delete record

Posted on by Microsoft Employee

Hi experts,

I have 2 tables TABLE1 and TABLE2, TABLE1 has a from, that form contains a button <Delete>. when i click delete button i insert TABLE1 records into TABLE2. 

My question :

how can i delete that TABLE1 record after inserting in TABLE2.

i created a record variable TABLE2 = table2

 DeleteButton OnPush()

table2.x := 1;

table2.y := 2;

IF table2.insert then begin

..................... (Need something here)

end;

*This post is locked for comments

  • Suggested answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: Delete record

    for the delete button in your form:

    call tab1rec.delete(true) // calls the ondelete trigger

    write into ondelete trigger of tab1:

    // your code: copy the values of tab1 rec into tab2

    // declare a local variable tab1copy; add then following code

    tab1copy.get(tab1.key); // means load the current tab1 rec with the defined prim. key

    // tab1copy now holds a copy of tab1 rec

    // now delete it

    tab1copy.delete;

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Delete record

    You can just say DELETE and it will delete the current record assuming that is the record you want to delete.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans