Copying data between tables

Hello All,

I am new to Microsoft Dynamics AX and currently being initiated to it by AX 2012. My problem is that I have a Form A with certain fields lets call them Field 1 and Field 2. I also have a table whose primary key is field 2 from the previous form A and has been populated with data. Now, I have another Form B with its own table which is called by a menu item button on Form A. What I want to achieve is that when I click on the menu item in Form A, it opens Form B and inserts data from the table whose primary key is field 2, but if data has already been inserted, then it skips this process and only adds any new data.

PLEASE HELP! I’m GOING CRAZY!

So what do you want when the form B is opened from form A?

I wanted Form B to have data pulled to it from a particular table where the PK of the table is similar to Field 2 from Form A.

I have however been able to sort this out. The problem was that in my click method for the button in Form A, I was passing a parameter which was not being picked. I decided to pass the whole record to the args class and that made it work. I will post the code here shortly with screenshots.

now the only problem is that it keeps on inserting duplicate records every time I call form B from A. I am thinking of counting if there are any records stored in Form B and only add if the return value of the count is 0. Problem with that is that if the table with data gets populated, I wont be able to pull the new data to Form B since once I write the first time the count will always return a value of >1. HELP.

You have two options:

  • check whether the record already exists before trying to insert it
  • try to insert the record without any check and handle exceptions if it already exists