View Single Post
  #2  
Old February 11th, 2009, 03:05 AM posted to microsoft.public.access.queries
MGFoster
external usenet poster
 
Posts: 653
Default Delete Specific Characters From Text

Jeff Monroe wrote:
I am trying to create an Update Query that will strip out certain
characters from a string in a text field (specifically hyphens and
slashes) while leaving the rest of the data in the record alone. The
characters do not exist in all records and they are located in
different positions in the field.

Examples: 1234-01, 12345-01, ABC/D, WX-YZ.
Desired Result: 123401, 1234501, ABCD, WXYZ.


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

Try this:

UPDATE table_name
SET column_name = Replace(Replace(column_name, "-",""),"/","")
WHERE column_name LIKE "*[/-]*"

Substitute your table name and column name where appropriate.

See the VBA Help article on the Replace Function for more info.

--
MGFoster:::mgf00 at earthlink decimal-point net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

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

iQA/AwUBSZJAhoechKqOuFEgEQIuwACePAZLkVWrqkt6HRyxXxkGZR mcZH0Aniqx
l8z6JcnMeWDRJLavj3dO6LyI
=izvD
-----END PGP SIGNATURE-----