Solved

How remove hyphens from field data in a table

Posted on 2014-11-19
2
228 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

772 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