Restoring a table when there are 2 tables in the screen

I think I have finally figured out a problem I was having.

I have a screen with 2 tables.

Normally these tables work fine. But not always.

I am including the code that restores data from the server to the invoices screen (table2).

The table itself is restored with and it works file.

But if I run
it does not always work properly.

I think its because the code does not state which table it is restoring to.

I don't know if there is some way of writing the code to direct the restore to table2.