Solved

Need to replace text in a description field of Access 2007

Posted on 2012-12-24
24
349 Views
Last Modified: 2012-12-24
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.
0
Comment
Question by:J.R. Sitman
  • 12
  • 8
  • 4
24 Comments
 
LVL 75
ID: 38719444
Try using this in your Update query:

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

Chr(39) is the apostrophe.

mc
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38719449
Update yourtable
Set Decription = replace(description, "I'm", "I am")


Make a backup before trying this.
0
 

Author Comment

by:J.R. Sitman
ID: 38719452
see attachment.   what is wrong?
query.jpg
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 38719456
Change your Criteria to:

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

mx
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38719458
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.
0
 

Author Closing Comment

by:J.R. Sitman
ID: 38719461
worked.

Thanks
0
 
LVL 75
ID: 38719462
Ignore my last post ...
0
 
LVL 75
ID: 38719463
No ... my post could not have worked ... any place a match was found, you would only end up with
I am ...

mx
0
 

Author Comment

by:J.R. Sitman
ID: 38719464
I'm confused.  It stated it found 524 records, so I updated it.
0
 
LVL 75
ID: 38719465
This will work:

UPDATE TableA SET TableA.Description = Replace([Description],"I" & Chr(39) & "m","I m")
WHERE (((TableA.Description) Is Not Null));
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38719466
Mx...it looks good. :-)
0
 
LVL 75
ID: 38719467
"so I updated it. "
Better look at your data .... :-(

Sorry ...
0
 

Author Comment

by:J.R. Sitman
ID: 38719470
so what do I search for that you think got changed?
0
 
LVL 75
ID: 38719471
"Mx...it looks good. :-) "

?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38719474
Joe... the replace statement you posted should have done the changes right.
0
 
LVL 75
ID: 38719477
You mean @ ID: 38719444 ?
If so ... then yes.  But not the 'Criteria' post ... cuz it would look 'gone!'

mx
0
 

Author Comment

by:J.R. Sitman
ID: 38719478
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));
0
 
LVL 75
ID: 38719479
"what the other query ..."

Which other query ?

mx
0
 

Author Comment

by:J.R. Sitman
ID: 38719487
this

Change your Criteria to:

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

mx
0
 
LVL 75
ID: 38719489
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.
0
 

Author Comment

by:J.R. Sitman
ID: 38719512
Well I do see several descriptions with just I am, however, many more with the proper description.  So not really sure exactly what happened.
0
 
LVL 75
ID: 38719523
Well ... part good and part bad.

The correct version is @ http:#a38719465 

mx
0
 

Author Comment

by:J.R. Sitman
ID: 38719524
how would I search in a query for just the '
0
 
LVL 75
ID: 38719526
Criteria:

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access Database 5 47
Weird Microsoft Access Error 8 41
Saving data on a subform when I close the form 12 31
MS Access How can I complete my Max, Group by query? 13 25
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question