473,414 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Uniform Formatting

I currently have a database with a field phone numbers however there are roughly 10000 records and 45-50 different entry styles.

I have now set up an input mask however I amk wondering how I could automate a clean up of them into the standard !(###) ###-####
Jun 25 '10 #1
2 1930
missinglinq
3,532 Expert 2GB
How could you possibly have 45-50 different ways of entering telephone numbers?

Linq ;0)>
Jun 25 '10 #2
OldBirdman
675 512MB
If it were I, I would not automate it. I would do it manually. To automate will require writing and debugging a fairly complex algorithm to handle 10-50 variations.

But by manually I don't mean 1 row (1 phone #) at a time.

Expand|Select|Wrap|Line Numbers
  1. Step 1: Make a copy of the table with name xxxCopy1
  2. Step 2: Open the original table in datasheet view.
  3.   Click in the phone # column
  4.   Open the Find/Replace dialog(cntl-H).
  5.   Click the Replace tab.
  6.   Replace all occurrances of "(" with "" (zero-length String)
  7. Step 3: Replace all occurrances of ")" with ""
  8. Steps 4-50 Replace all other special characters with ""
  9.   This may include []{},./-_ and anything else except the alphabet and number set
  10. Step 51: Make a copy of the table with name xxxCopy2
  11. Step 52: Change all occurrances of " "(spaces) with ""
  12. Step 53: Make a copy of the table with name xxxCopy3
  13. Note:
  14.   All phone numbers are now ####### or ##########, unless some have leading 1's (i.e. 1-### ###-####) or overseas/foreign numbers.
  15. Step 54:   Write a SELECT query WHERE LEFT(Phone#,1)="1" to see if any leading 1's.  If so, change to an UPDATE query and replace [Phone#] with MID([Phone#],2)
  16. Step 55: Make a copy of the table with name xxxCopy4
  17. Step 56: Write a SELECT query WHERE LEN([Phone#])=7 to see if any Phone# without AreaCode.  If so, change to an UPDATE query and replace [Phone#] with "303" & [Phone#] NOTE-USE YOUR DEFAULT AREACODE, not 303
  18. Step 57: Run an UPDATE query with no WHERE clause and change all [Phone#] to "(" & MID([Phone#],1,3) & ") " & MID([Phone#],4,3) & "-" & MID([Phone#],7)
  19.  
Above assumes table field is [Phone#], and your area code is 303. Change as necessary.
It took me less time to do the project than it did to type this message. Should take about 15 minutes, total.
Jun 26 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Doron | last post by:
is there a setting that will ebnable uniform extent allocation upon creation of index/table by default ? if there isn't any default setting can you code it in? thanks, Doron
6
by: TomT | last post by:
Hi, I've created a form that has a 3 fields. 2 textboxes (username & password) 1 TextArea (notes) I have linked this to an access DB. This is working well, the user enters thier Username...
1
by: Robert Oschler | last post by:
Is there a Javascript function, or library, that will take a URL and make it uniform/consistent? Something that will resolve all relative pathing and the current domain and protocol and return a...
2
by: Jozef | last post by:
Hello, I have a report that contains a memo field that can contain quite a bit of information. There are actually a couple of fields like this. When I use can grow / can shrink, the report...
5
by: marcosegurini | last post by:
Hi, the following class describes my actual problem: class DeepCopy<T> { T val_; public void Assign(T newVal) {
4
by: Curious | last post by:
Hi, I am writing a class Distribution that inherits from Random class public class Distribution : System.Random { public int Uniform(int min, int max) { return this.Uniform(min, max); }
38
by: JTL | last post by:
I have learnt java before and now begin to learn c++ what puzzle me is that seem that different SDKs(c++builder, vs.net, gcc..) has its own class library we know that in java there are only one...
8
by: kiranchahar | last post by:
Hey all, How do I generate random numbers with Uniform distribution Uniform(a,b) using C-programming? I want to generate uniform random numbers which have mean following Uniform(p,q) and also...
25
by: tooru honda | last post by:
Hi, I have read the source code of the built-in random module, random.py. After also reading Wiki article on Knuth Shuffle algorithm, I wonder if the shuffle method implemented in random.py...
14
by: Hendrik Maryns | last post by:
Hi, Since I was so pleased to discover how to enable my keyboard to type symbols like … directly, I made a howto-page about it: http://tcl.sfs.uni-tuebingen.de/~hendrik/keyboard.shtml. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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,...
0
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...

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.