Seperating numbers from names

  • Thread starter Thread starter Brett G via AccessMonster.com
  • Start date Start date
B

Brett G via AccessMonster.com

I cant remember how to do this.
If i have a street address like 100 MAIN ST. I want to seperate the 100 from
the text.

How do i do that
 
The simple way is to just use the LEFT function: LEFT(variable,3) should give
you '100'. If you're given a variable length string to parse each time, the
numbers won't always be in the first three positions. Read up on the use of
functions INSTR and MID to learn how to parse these.
 
Brett said:
If i have a street address like 100 MAIN ST. I want to seperate the 100 from
the text.


Caution! There are a lot of addresses that do not contain
numbers at the beginning of a street address. My previous
address was 0S425 Florida Lane. Others I've seen are like
Bldg 13A Commerce Drive and some are just a place name.

If you have a way to deal with all the anomalous forms of
addresses, you can deal with the "normal" ones with code
like:

StreetNum = Val(address)
StreetName = Mid(address, Len(StreetNum) +1)
 
Marshall,

Don't know why, but it never occurred to me that you can strip a numeric
prefix from a string this way. Neat trick.

Thanks,
Dale
 
Back
Top