A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Delete Specific Characters From Text



 
 
Thread Tools Display Modes
  #1  
Old February 10th, 2009, 11:22 PM
Jeff Monroe Jeff Monroe is offline
Member
 
First recorded activity by OfficeFrustration: May 2006
Location: San Diego, CA
Posts: 27
Default Delete Specific Characters From Text

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.

Thanks for any help.
jeff
  #2  
Old February 11th, 2009, 04: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-----
  #3  
Old February 11th, 2009, 07:16 AM
Jeff Monroe Jeff Monroe is offline
Member
 
First recorded activity by OfficeFrustration: May 2006
Location: San Diego, CA
Posts: 27
Default

MG:

Thank you very much for the tip. It worked exaclty as I needed. You saved me hours of manually deleting the characters I don't want.

Jeff
__________________
jm
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.