Solved

How remove hyphens from field data in a table

Posted on 2014-11-19
2
226 Views
Last Modified: 2014-11-19
I have a table that has a text field.  The data in this field for all records has hyphens.  For example:

01-0209-090-1030

I want to remove the hypens using a query so that the end result, for example, is 0102090901030.

How can I do this?
0
Comment
Question by:SteveL13
2 Comments
 
LVL 33

Accepted Solution

by:
Mike Eghtebas earned 250 total points
ID: 40453062
Dim strTemp As String

strTemp ="01-0209-090-1030"    

strTemp = Replace (strTemp , "-", " ")  '<-- this will give 01 0209 090 1030

strTemp = Replace (strTemp , "-", "")  '<-- this will give 0102090901030

strTemp = Replace (strTemp , "-", "*")  '<-- this will give 01*0209*090*1030
0
 
LVL 22

Assisted Solution

by:Kelvin Sparks
Kelvin Sparks earned 250 total points
ID: 40453097
To build on @eghtebas response to do in a query

UPDATE yourtable SET fieldname = REPLACE(fieldname,"-","") will give you the outcome that you're looking for.

Edit my code to put your table name into the yourtable part, and the column name into the fieldname part (2 places).


Kelvin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now