Avatar of J.R. Sitman
J.R. Sitman
Flag for United States of America asked on

Need to replace text in a description field of Access 2007

In the description field of our database I need to find and replace I'm with I am.  When I try this using the find and replace it doesn't find anything.  So I tried making an update query with I am as the update to and I'm as the criteria.  It finds o records.  There are plenty of records with "I'm" so how do I change it?

The reason I need this ASAP is because the "I'm" code messes up our uploads of the database to PetFinder.
Microsoft Access

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

8/22/2022 - Mon
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Try using this in your Update query:

Replace([YourFieldName],"I" & Chr(39) & "m" , "I am")

Chr(39) is the apostrophe.

mc
mbizup

Update yourtable
Set Decription = replace(description, "I'm", "I am")


Make a backup before trying this.
J.R. Sitman

ASKER
see attachment.   what is wrong?
query.jpg
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
mbizup

The criteria is only allowing descriptions that are exactly  I'm.

Did you try what i posted?   It should work for descriptions that *contain*  I'm.  Its the criteria that is messing you up.
J.R. Sitman

ASKER
worked.

Thanks
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Ignore my last post ...
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

No ... my post could not have worked ... any place a match was found, you would only end up with
I am ...

mx
J.R. Sitman

ASKER
I'm confused.  It stated it found 524 records, so I updated it.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

This will work:

UPDATE TableA SET TableA.Description = Replace([Description],"I" & Chr(39) & "m","I m")
WHERE (((TableA.Description) Is Not Null));
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
mbizup

Mx...it looks good. :-)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

"so I updated it. "
Better look at your data .... :-(

Sorry ...
J.R. Sitman

ASKER
so what do I search for that you think got changed?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

"Mx...it looks good. :-) "

?
mbizup

Joe... the replace statement you posted should have done the changes right.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

You mean @ ID: 38719444 ?
If so ... then yes.  But not the 'Criteria' post ... cuz it would look 'gone!'

mx
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
J.R. Sitman

ASKER
With this query it's finding 2048 which is more relaistic.  I'm still wondering what the other query updated?

UPDATE TableA SET TableA.Description = Replace([Description],"I" & Chr(39) & "m","I m")
WHERE (((TableA.Description) Is Not Null));
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

"what the other query ..."

Which other query ?

mx
J.R. Sitman

ASKER
this

Change your Criteria to:

InStr(1,[Description], "I" & Chr(39) & "m") >0

mx
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

That ... would hose your data.  Any place in Description where I'm was found ... the entire Description would be replaces with just I am - based on what you have in the Update To cell.

However ...

IF ... you used my very first post (ie, the first post in the thread) ... then you are OK.
J.R. Sitman

ASKER
Well I do see several descriptions with just I am, however, many more with the proper description.  So not really sure exactly what happened.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Well ... part good and part bad.

The correct version is @ http:#a38719465 

mx
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
J.R. Sitman

ASKER
how would I search in a query for just the '
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Criteria:

Instr(1, [Description], Chr(39)) > 0