Even if you put together data from the single values as you do now, for whatever reason you could simply do it fro left to right, then you wouldn't need STUFF and complicated terms to find the position where to stuff in data. You simply concatenate from left to right, then all you need is ALLTRIM() and +. Actually you can for example combine a firstname and lastname with firstname-(" "+lastname) instead of alltrim(firstname)+" "+Alltrim(lastname), so you even can concatenate the padded field values without alltrimming them by the nature of the - operator for string concatenation. Also a rarley known feature of VFP.
So:
1. It's easier to search in distinct fields with separate and many indexes. SQL-Select can make use of many indexes in a WHERE clause opposed to FOR optimiation and opposed to non optimizable $ instring search
2. It's easier to put together distinct fields to a concatenated value.
3. It's easier to do 2. from left to right, simply using +,- and alltrim, textmerge and transform, no need for AT/RAT position determination and STUFF, then.
We can only assume you're in a state with data somewhere in between being distinct values and the concatenated value you tend to go. You're going in the wrong direction, you'll optimize your data, if you spearate the values that are already combined.
So dan has really put the finger on the weak point of what you're currently accomplishing.
One more note, since you're at VFP6, you don't have textmerge() as function, but you have TEXT...ENDTEXT, and you have \ and \\ commands, see the help.
And one more side note: "field in question is only 50 characters". You can test if that's enough, if you know how much characters you're adding as worst case. Eg a space from the previous thread and a 4-5 letter code pkus another space, say 10 chars, RIGHT(field,10) has to be empty to add 10 chars somewhere without cutting off something, so simply BROWSE FOR NOT RIGHT(field,10)==SPACE(10) and you'll see all records that won't be able to hold the extended value. There is no need to wait and test, and how would you determine a loss afterwards? It won't be obvious if "...some company...(some area) 12" is really about vehicle 12 or it was vehicle 120-129 or even higher.
Another advantage of putting together the whole name when you need it is you'd not create it in a limited width field but as a string expression in memory, which is limited to about 16 million characters, a ridiculous limit for anything you print on a line of a report.
Bye, Olaf.