Chances are that the fact that duplicate record makes the newly created record the current record and locates that record at the end of the found set is why your script has failed.
You may need to duplicate a record and then omit it to remove it from the found set and use go to record [first] to return to the original record, then you omit that record as well when your script has finished duplicating it.
Then you use exit If to exit the loop--exiting the loop when the found count is zero.
But to be sure would require you to post your script:
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- 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 and easier to read format.