Instr/Replace?

T

Tom

Any sugestions on how to do the following:

Am using the Instr function to search for particular text
within one field and want to be able to replace that text
with other text
 
D

Douglas J. Steele

Why not just use the Replace function?

NewString = Replace(OriginalString, StringToFind, StringToReplaceWith)
 
G

Graham Mandeno

Hi Tom

Are you using Access 2000 or later? If so, there is a Replace function to
do this.

If you want to be more selective, then you can use code something like this:
iPos = Instr ( strOriginal, strToFind )
strResult = Left( strOriginal, iPos-1 ) & strToReplace _
& Mid( strOriginal, iPos+Len(strToFind) )

In plain English, join together the bit to the left of the string you found,
the new string, and the bit to the right of the string you found.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top