That's a very inefficient way to solve this since you have to loop through all records x number of times.
How about this:
- use ExecuteSQL() to gather all the file names
- loop through the list and use FilterValues() to check for duplicates and keep track of which ones in a separate list
- when done looping, do a search for each one in the separate list and rename them
- simply do a search for "!" in the filename field, which will give you all the duplicates
- sort by file name which will group the dups together
- loop through that smaller founds to rename
Thanks Wim That helps !