Solved

Need to replace text in a description field of Access 2007

Posted on 2012-12-24
24
351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

691 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