?
Solved

Need to replace text in a description field of Access 2007

Posted on 2012-12-24
24
Medium Priority
?
356 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
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 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

Industry Leaders: 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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

807 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