Solved

Need to replace text in a description field of Access 2007

Posted on 2012-12-24
24
346 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:jrsitman
  • 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:jrsitman
ID: 38719452
see attachment.   what is wrong?
query.jpg
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) 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:jrsitman
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:jrsitman
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:jrsitman
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:jrsitman
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:jrsitman
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:jrsitman
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:jrsitman
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now