>Nadya, I don't think you can use the scan command this way. Any part of the 'For' condition in the Scan loop shouldn't change while scanning. Try to use 'replace' command with the 'for' option in the scan loop and the keyword 'all' instead.
It works fine in other cases. Actually, I put in in natural order and the SCAN worked... I also removed relation and restore it after replacement...
If it's not broken, fix it until it is.
My Blog