I can't add more than 1 find/replace functions in my script I get a "field not selected error" when i run it. e.g.
find/replace("Tx", "Wa", Find Next)
find/replace("UT", "AL", Find Next)
If I only have 1 find/replace it works. How can I add more than one find/replace function?
I assume you're talking about the Perform Find/Replace[ ] script command...
In which case, the first thing I'd say is the behavior of the command depends on what options you've selected, but only requires that a field be active when the command executes if the 'current field' radio button is selected. Moreover, the command leaves a field selected after it runs - provided it finds at least one instance of the search string.
The only combination of options I'm aware of involving two successive Perform Find/Replace[ ] commands that would result in the first completing correctly and the second throwing a field not selected error would be if the first command were set to target a search string that isn't found, and the second is configured with the "Current field" search option. Soince the first command fails, it leaves no field selected, and the second requires a selection and therefore will throw an error.
If that's the case, you should consider putting a Go to Field[ ] command between the two Perform Find/Replace[ ] commands to ensure that the appropriate field is selected before the second Find/Replace[ ] command executes. Moreover, if there is any chance that the script will ever be run when the user is on a layout where the targeted field(s) are not present, then you should consider adding a Go to Layout[ ] command as well.
The second thing I'd say is it appears to have a Perform Find/Replace[ ] command with the "Find Next" option immediately followed by another Perform Find/Replace[ ] with a different search string, since selection of the first value "Tx" is immediately made redundant by selection of the second value "UT". Moreover the commands as stated in your message include both a search string and a replace string - yet the replace string is redundant when the Find or Find Next operations are chosen.
A third and more general observation I'd make is that commands that work with the fields on the layout - such as Perform Find/Replace[ ] - tend to be fragile in that they depend on layout and/or field focus. Unless there is a particular reason why you need to script to locate and *select* a value in a field on the layout, it may be preferable (in speed and reliability) to use a different approach such as Perform Find[ ], Set Field[ ] etc, depending on what it is that your script is designed to achieve.
R J Cologon, Ph.D.
FileMaker Certified Developer
Author, FileMaker Pro 10 Bible
NightWing Enterprises, Melbourne, Australia