Try breaking it down into steps
Instead of
.CommandText = Replace(PTCache.CommandText, OldString,
NewString)
Use:
Newcommand= .CommandText
Replace(Newcommand, OldString, NewString)
.CommandText= Newcommand
Then you will find out which part is throwing the error.
I would also put MsgBox(NewCommand) in between each of these lines