A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Convert data.



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2004, 03:51 PM
Robert
external usenet poster
 
Posts: n/a
Default Convert data.

I have a table with phone number that were imported in the
following format (212)-555-0440. The field is set to text,
with no input masks.

I need to convert the numbers into a number field sothey
are stored as follows: 2125550440.

How would I formulate an Update query to do this
conversion?

Thanks
  #2  
Old May 25th, 2004, 06:17 PM
Andrew L.
external usenet poster
 
Posts: n/a
Default Convert data.

Robert

Keep your field as text, not numerical. If all your records are exactly the same length and
format:-

update to:Mid([yourfield],2,3) & Mid([yourfield],7,3) & Right([yourfield],4)

If your records are not exactly the same length/format, you will probably need Instr() which locates
a piece of text within another.

hth
Andrew L.

"Robert" wrote in message
...
I have a table with phone number that were imported in the
following format (212)-555-0440. The field is set to text,
with no input masks.

I need to convert the numbers into a number field sothey
are stored as follows: 2125550440.

How would I formulate an Update query to do this
conversion?

Thanks


  #3  
Old May 26th, 2004, 10:56 AM
ali kwok
external usenet poster
 
Posts: n/a
Default Convert data.

Or, if you can't rely on the format being identical every time:

Replace(Replace(Replace(yourString,"(",""),")","") ,"-","")

Ali

----- Andrew L. wrote: -----

Robert

Keep your field as text, not numerical. If all your records are exactly the same length and
format:-

update to:Mid([yourfield],2,3) & Mid([yourfield],7,3) & Right([yourfield],4)

If your records are not exactly the same length/format, you will probably need Instr() which locates
a piece of text within another.

hth
Andrew L.

"Robert" wrote in message
...
I have a table with phone number that were imported in the
following format (212)-555-0440. The field is set to text,
with no input masks.
I need to convert the numbers into a number field sothey

are stored as follows: 2125550440.
How would I formulate an Update query to do this

conversion?
Thanks



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.