string comparision in access

hi ,
I need to update all rows in a table only for a certain field.
however i only need to update the value starting from position 5 to 3 byes.
like
update table_a
set field_a(5,3) = "555"

but i do not know the proper syntax.
thanks
chakrikaAsked:
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.

perkcCommented:
Use the 'Replace' function:

UPDATE table_a
SET field_a = replace([table_a]![field_a],5,3,"555");

perkc
0
chakrikaAuthor Commented:
Hi i tried to do that. but i get the following  error message:
Microsoft Access didn't update 0 field(s) due to a type conversion failure, 0 records(s) due to key violations, 0 records(s) due to lock violations, and 32 record(s) due to validation rule violations Do you want to continue running this type of action query anyway? To ignore the error(s) and run the query, click yes. For an explanation of the causes of the violations, click Help.
0
chakrikaAuthor Commented:
I changed teh query to do this.
UPDATE table_a
SET field_a = replace(5,3,"555");

but then it replaced the entire value in the table with onlyjust '5'.

thanks
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.

chakrikaAuthor Commented:
ok i understand that the replace function should be used like this
REPLACE(old_text,start_num,num_chars,new_text)

 
But still i get the error message i mentioned above. I cannot update.
0
perkcCommented:
Give me a couple of examples of the type of values that you have in the 'field_a' field.

Also, what format is the field_a table field? Text? Number?
0
kaliosCommented:
chakrika, use something like this.
lets say the field_a is 10 bytes. so use this:

UPDATE table_a
SET table_a.[field_a] = MID(table_a.[field_a],1,4) & "555" & MID(table_a.[field_a],8,3);

Kalios
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
chakrikaAuthor Commented:
super kalios.

works like a charm
thanks
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.