|
-
May 31st, 2011, 07:22 PM
#1
Thread Starter
New Member
Access: convert data type from text to a number HELP!!
Ok I created a access database a long time ago, crm type database but due to poor decision making at the time I have stored phone numbers in a text data type but the data has come from a mask edit textbox in the format of: (00) 0000 0000
So I want to convert it to a plain number field but need to workout how?
Someone please help..
-
May 31st, 2011, 07:47 PM
#2
Re: Access: convert data type from text to a number HELP!!
IMO You could develop a conversion routine:
1.- Copy the table (now it's the old table)
2.- Change field data type to numeric in new table
3.- Read from old table/field
4.- Remove unwanted characters
5.- Write new table/field
Now, I have developed a lot of applications and always used telephone number field as string with no problem at all... it's only one more field of information
Let's wait the experts' opinion
JG
-
May 31st, 2011, 08:18 PM
#3
Thread Starter
New Member
Re: Access: convert data type from text to a number HELP!!
if I want to just keep it as a string but remove all the formatting eg ( ) _ what sql command do I need to run to change them all.
if I run:
SELECT Replace(Replace(Replace(Replace(phone,"(",""),"_",""),")","")," ","") FROM tblClients;
it displays the number the way I want it to but how do I make the changes?
use the Update command?
-
Jun 1st, 2011, 03:47 AM
#4
Re: Access: convert data type from text to a number HELP!!
Something like this.
Code:
UPDATE tblClients SET phone =Replace(Replace(Replace(Replace(phone,"(",""),"_",""),")","")," ","")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|