473,387 Members | 1,540 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,387 software developers and data experts.

Remvoing numbers from a text field

Hi
Does anyone have some code that will extract the house number from the
street name? There is a space in between the number and the street
name. All the numbers can be varied lengths. The number is the first
entry in the field.

ex: 123 main st
45466 South St

I am looking to get
123
45466

Thanks for any help
Apr 8 '08 #1
6 1492
<Sm******@aol.comwrote in message
news:a6**********************************@8g2000hs u.googlegroups.com...
Hi
Does anyone have some code that will extract the house number from the
street name? There is a space in between the number and the street
name. All the numbers can be varied lengths. The number is the first
entry in the field.

ex: 123 main st
45466 South St

I am looking to get
123
45466

Thanks for any help
Use the InStr function to detect the position of the first space and then
use the result in the Left function to return just the number.
Incidentally, in a normalised system you would have the number stored in its
own field.

Left([MyField],InStr([MyField]," ")-1)

Keith.
www.keithwilby.com

Apr 8 '08 #2
Sm******@aol.com wrote:
Hi
Does anyone have some code that will extract the house number from the
street name? There is a space in between the number and the street
name. All the numbers can be varied lengths. The number is the first
entry in the field.

ex: 123 main st
45466 South St

I am looking to get
123
45466

Thanks for any help
Left(Address,Instr(Address," ")-1)

I'd only do that if you are positive the address has a space and perhaps
verify it's a number.
If Instr(Address," ") 0 then
strAddress = Left(Address,Instr(Address," ")-1)
If IsNumeric(strAddress) then Me.Streetnum = strAddress
Endif

Rome
http://www.youtube.com/watch?v=ldk9s76WLsc

Apr 8 '08 #3
On Apr 8, 11:54*am, Salad <o...@vinegar.comwrote:
Smyth...@aol.com wrote:
Hi
Does anyone have some code that will extract the house number from the
street name? *There is a space in between the number and the street
name. *All the numbers can be varied lengths. *The number is the first
entry in the field.
ex: *123 main st
* * * 45466 South St
I am looking to get
123
45466
Thanks for any help

Left(Address,Instr(Address," ")-1)

I'd only do that if you are positive the address has a space and perhaps
verify it's a number.
* * * * If Instr(Address," ") 0 then
* * * * * * * * strAddress = Left(Address,Instr(Address," ")-1)
* * * * * * * * If IsNumeric(strAddress) then Me.Streetnum= strAddress
* * * * Endif

Romehttp://www.youtube.com/watch?v=ldk9s76WLsc
Thank you Both. Both worked like a charm!!!
Apr 8 '08 #4
<Sm******@aol.comwrote
Thank you Both. Both worked like a charm!!!
Apparently you did not encounter it, but be on the alert for addresses where
the number is spelled out, as in, "Twenty-one Financial Boulevard" or "One
Microsoft Way". Those might require some special handling.

Larry Linson
Microsoft Office Access MVP
Apr 8 '08 #5
On Tue, 8 Apr 2008 16:01:12 +0100, "Keith Wilby" <he**@there.com>
wrote:
><Sm******@aol.comwrote in message
news:a6**********************************@8g2000h su.googlegroups.com...
>Does anyone have some code that will extract the house number from the
street name? There is a space in between the number and the street
name. All the numbers can be varied lengths. The number is the first
entry in the field.
ex: 123 main st
45466 South St
I am looking to get
123
45466
>Use the InStr function to detect the position of the first space and then
use the result in the Left function to return just the number.
Incidentally, in a normalised system you would have the number stored in its
own field.
Addresses are "special" cases, Keith. Personally, I'm not sure they
*can* be normalized, as there are just so darn many systems out there!
How would you normalize what "Smythe32" posted along with a series of
PO Boxes.
"P.O. Box 1234" for example.

--
Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!
Apr 8 '08 #6
"Chuck Grimsby" <c.*******@worldnet.att.net.invalidwrote in message
news:46********************************@4ax.com...
>
Addresses are "special" cases, Keith. Personally, I'm not sure they
*can* be normalized, as there are just so darn many systems out there!
How would you normalize what "Smythe32" posted along with a series of
PO Boxes.
"P.O. Box 1234" for example.
IMO your example is the first line of the address and the house number is
null.

Regards,
Keith.

Apr 10 '08 #7

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

Similar topics

2
by: Paulo Rodrigues | last post by:
Hi I would like some help about the following : I have a text field and I don't want it contains any numbers. How can I limit this situation ? So far, I couldn't find literature exacly...
3
by: Stewart Allen | last post by:
Hi there I'm trying to find part serial numbers between 2 numbers. The user selects a part number from a combo box and then enters a range of serial numbers into 2 text boxes and the resulting...
9
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want...
2
by: Michael Hager | last post by:
Hello all, I have a client that has a database that produces certificates using an access report. The certificate has a picture of the person on it. The pictures were stored by SSN number, and...
8
by: microsoft.news.com | last post by:
I have a text file that has a column of numbers that i need to add to get a total of. Is there any way to add the number column in my text file? the text file looks like this: BMW ...
5
by: rajsa | last post by:
Using a setvalue macro, I'm trying to concatenate several fields, all of which are set as 'text', but some of which contain only numbers. (Gathering data from a form into one field, then saving this...
8
by: Abedin | last post by:
I have 9 digits in form of "111020402". Then I have another 9 digits in form of "111020403". I have 100,000 records of these two 9-digit numbers. I want to filter this as follows: District:...
3
by: Klaus Brune | last post by:
Hello all, When one tabs through a form (specifically, in Firefox), all the text in a field is automatically selected. What I'm looking for is a way to put a function (in onFocus perhaps)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.