It might help to see a copy of that script.
Some part of that script, possibly a commit records step, possibly others is changing the layout focus and that loses track of what portal row was current at the time you initiated this script. You can capture the row number in a variable in order to return to it. There is also likely a way to do what you want without interacting with portal rows like this.
Scripts that interact with portal rows are vulnerable to breaking when someone alters the layout design in the future. It isn't always possbile, but if you can get the job done without interacting with specific portal rows, your script is less vulnerable to such issues.
To post a script to the forum:
- You can upload a screen shot of your script by clicking the edit link to your original message and uploading it there
- You can upload a screen shot to a file share site and post the download link to a new response you post here.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF.
- If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional look to your script. (Use the HTML option and paste the text into the HTML editor.)