473,503 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove dash from soc sce #

I would to remove dashes from 111-22-5555.
I am importing text file and some of the numbers have dashes and some
don't

Thanks

Nov 13 '05 #1
4 23129
Use Replace() in an Update query to lose the dashes.

1. Create a query into this table.

2. Add your field to the output grid.
In the Criteria row under this field, enter:
Is Not Null

3. Change it to an Update query (Update on Query menu.)
Access adds an Update row to the grid.

4. In the Update row, enter:
Replace([SSN], "-", "")
substituting your field name for SSN.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Paul" <pa**@tdsd.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I would to remove dashes from 111-22-5555.
I am importing text file and some of the numbers have dashes and some
don't

Nov 13 '05 #2
Replace Function doesn't work in a query in Access 2000!

Nov 13 '05 #3
I believe it may work in later versions of Access 2000 (i.e. all service
packs applied), but if not, then create a user defined function and name it
something like MyReplace. Call this function from the query, passing the
parameters. In the user defined function, use the Replace function to do the
work and assign the corrected string to the user defined function.

--
Wayne Morgan
MS Access MVP
"Paul" <pa**@tdsd.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Replace Function doesn't work in a query in Access 2000!

Nov 13 '05 #4
There is a Microsoft article on that:
http://support.microsoft.com/?id=225956
It suggests writing a little wrapper function that you can use in a query.

If you can't get that going, and want to code your own:

Function ReplaceX(strExpr As String, strFind As String, strReplace As
String, Optional lngStart As Long = 1) As String
Dim strOut As String
Dim lngLenExpr As Long
Dim lngLenFind As Long
Dim lng As Long

lngLenExpr = Len(strExpr)
lngLenFind = Len(strFind)

If (lngLenExpr > 0) And (lngLenFind > 0) And (lngLenExpr >= lngStart)
Then
lng = lngStart
If lng > 1 Then
strOut = Left$(strExpr, lng - 1)
End If
Do While lng <= lngLenExpr
If Mid(strExpr, lng, lngLenFind) = strFind Then
strOut = strOut & strReplace
lng = lng + lngLenFind
Else
strOut = strOut & Mid(strExpr, lng, 1)
lng = lng + 1
End If
Loop
ReplaceX = strOut
End If
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Paul" <pa**@tdsd.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Replace Function doesn't work in a query in Access 2000!

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3448
by: el_roachmeister | last post by:
How can I correct this error apart from eliminating the dash in United-Kingdom? Couldn't execute query 'SELECT * FROM United-Kingdom ORDER BY level DESC': You have an error in your SQL syntax....
163
14481
by: Shiperton Henethe | last post by:
Hi Know any good utilities to help me strip out the tags that Microsoft Excel 2002 leaved behind when you try and export an HTML format file? This is driving me NUTS. And really makes me...
12
5190
by: Oberon | last post by:
I have a large HTML document. It has hundreds of <span>s which have no attributes so these <span>s are redundant. How can I remove these tags automatically? The document also has <span>s with...
1
7259
by: Sue | last post by:
Hello I'm new to this Regular Expression and need some help. I want to restrict what the user types in a text box. The User can type only A-Z, a-z, 0-9, spaces, comma, dash, period, single...
1
1461
by: mats.broberg | last post by:
Dear all, I'm having a scientific text translated into the majority of western and eastern European languages* and have provided a small leaflet with typesetting rules for the translators. Some...
19
3794
by: Carson | last post by:
Is it possible to remove the dashes in a social security number using sprintf? If so what would the syntax look like? If sprintf won't do this is there a C function that will?
3
3910
by: Sebastian M. Rouaiha | last post by:
Hi. I have a problem. When drawing into a graphics context I sometimes get access violation exceptions and I can't figure out why. It seems to have to do with the use of custom dashes. If I...
0
2310
by: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= | last post by:
"C:\Python24\Lib\site-packages\MySQLdb\cursors.py", line 149, in Here it complains that it deals with the character U+2013, which is "EN DASH"; it complains that the encoding called "latin-1"...
18
7400
by: Bigdaddrock | last post by:
I have a table that has two fields that are identically formatted TEXT boxes with field size of 12 (more than necessary, but memory is not an issue). On both I have the Input Mask set for Zip Codes,...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.