Solved

Need to replace text in a description field of Access 2007

Posted on 2012-12-24
24
345 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

708 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

19 Experts available now in Live!

Get 1:1 Help Now