Access Update Query to replace values with other values

Table: DSCNSKPIUPDATE2
Field: Reject

I have data values that resemble the below format.
R0102447 / R0102448

I want to replace the " / " with a ",". I tried with the below code but it does not work.

UPDATE DSCNSkpiUpdate2 SET DSCNSkpiUpdate2.Rank = Replace(Rank," / ",",");

Open in new window


Any ideas how to fix this?
ggodwinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert ShermanOwnerCommented:
Something like this should work.  You may have to tweak it a bit to deal with spaces according to what you want the end field to look like:

UPDATE Table1 SET Table1.text1 = Left([text1],InStr([text1],"/")-1) & "," & Mid([text1],InStr([text1],"/")+1);

Open in new window


EDIT: Obviously, the [text1] field name should be replaced with the proper field name for you table.
0
Rey Obrero (Capricorn1)Commented:
try

UPDATE DSCNSkpiUpdate2 SET DSCNSkpiUpdate2.[Rank] = Replace(Replace([Rank]," ",""),"/","")

this means if "/" is present, replace with , and remove the space
0
ggodwinAuthor Commented:
Robert,
Your code actually delected everything in the field.

Rey,
Your code did the same as mine. It appears to work, but then the expected outcome to the tables never changes.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Rey Obrero (Capricorn1)Commented:
can you upload a copy of the db with the table in question.
0
ggodwinAuthor Commented:
Ok, I realized that I entered something into the code wrong and it appeared to work.
However, once it did execute it also removed some coma's that needed to stay in place.

Here is the db.

In the reject column i need these format to read as
R0117536,R0117789,R0117123

Instead of any other format. I need to do this so that I can try and use the information you gave me yesterday.
0
Rey Obrero (Capricorn1)Commented:
where is the db?

<However, once it did execute it also removed some coma's that needed to stay in place.>

the code i posted will never do that..
0
ggodwinAuthor Commented:
I must not have uploaded before I posted.
Database11.mdb
0
Rey Obrero (Capricorn1)Commented:
copy and paste this query and run

UPDATE DSCNSKPIUPDATE2 SET DSCNSKPIUPDATE2.Reject = Replace(Replace([Reject]," ",""),"/",",");
Database11.mdb
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert ShermanOwnerCommented:
When you used my code, I suspect you might have missed renaming something which could have caused the field to be updated to empty.

At any rate, I'm a really old-school Access user... In my day, we didn't have such new-fangled functions as Replace.  :D  Occasionally, my brain decides to program like it's 1989...  Rey's method is the way to go, for sure!
0
ggodwinAuthor Commented:
Bingo. Worked perfectly.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.