Partial String Update

  • Thread starter Thread starter Wayne Emminizer
  • Start date Start date
W

Wayne Emminizer

I have a field - NewItemName - which I need to find a
replace a specific string value in. The string value to
fin is "H- G-" and should be replaced with "H&G" while
leaving the remainder of the field name intact. I can
run a query and find "H- G-" but can't figure out how to
replace just that part of the name. I can manually go to
Edit-Replace and do it when seaching any part of the
field....any ideas how to do that?
 
Wayne said:
I have a field - NewItemName - which I need to find a
replace a specific string value in. The string value to
fin is "H- G-" and should be replaced with "H&G" while
leaving the remainder of the field name intact. I can
run a query and find "H- G-" but can't figure out how to
replace just that part of the name. I can manually go to
Edit-Replace and do it when seaching any part of the
field....any ideas how to do that?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If you're using Acc2000 & greater versions you can use the Replace()
function. E.g.:

UPDATE TableName
SET NewItemName = Replace(NewItemName, "H- G-", "H&G")
WHERE NewItemName Like "*H- G-*"

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQHWpKYechKqOuFEgEQKmFwCgoaRvQJ9q0U7bS/wJYPMg+EXB8jUAoKPe
yXKa9yN6ymzmynXRCEJU+mI/
=DNNi
-----END PGP SIGNATURE-----
 
You have to use the Replace function within an Update
Query.

In your update query. You will need to create an
expression column for each field you will be correcting
the information in. At the top of each expression column
you should have something like:

Expr1: Replace(sourcefield, "H- G-", "H&G")

Expr1 can be any name you want. This query can be
appended or cut & pasted back to your table.

Good luck.

Kevin11
 
I could be a little clearer. Use the replace function I
told you about with the Update Query information within
you MS Access help file.

Kevin11
 
Back
Top