I want a user to be able to do a search in the layout/table "Cages" and then click a button to run a script that will create a new record in a table called "CagesProtocolLineHistory" for each record in the found set.

Below is what I have so far which almost works but on go to original layout line it doesn't go to the next record, it goes to a record near the end. I.e., it's skipping some records.

![enter image description here](https://i.stack.imgur.com/QFuTy.png)