>I found a problem. Somehow the lcPattern variable definition was changed. Instead of
>
lcPattern=left(tcDBFName,lnPos+1)+'???'+substr(tcDBFName,lnPos+4)
>it was something different. Therefore the program just didn't do anything...
>
>I'm testing the speed difference right now.
>
>>>Should I revert the code back to the original cursor idea?
>>
>>As far as effeicent goes, I'd bet that the cursor idea is faster anyways, so yes. You could easily test it out.
If speed is the issue, and you're replacing a character by character (not string by string), you may check using ChrTran() instead of StrTran() - it should be faster.
Another handy trick, assuming you're replacing two characters with three question marks, instead of
lcPattern=left(tcDBFName,lnPos+1)+'???'+substr(tcDBFName,lnPos+4)
you could use
lcPattern=Stuff(tcDBFName,lnPos+2, 2, '???')
A single function should be faster than two functions plus two string concatenateions. Besides, I always thought that all the string chopping functions (left, right, substr()) are internally done as Stuff() with special parameters.