Solved

How remove hyphens from field data in a table

Posted on 2014-11-19
2
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

630 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