Extracting Street Number | | |
Hi,
I'm trying to clean up a large database in Access. I have one field for
address, which needs to be broken up into Street Number, Street Name, and
Street Label (St., Road, etc.)
The problem is that the data is very dirty. So some addresses will be
standard "456 XYZ Road," while others won't have a number and will just say
"XYZ Industrial Park," meaning I can't just use Instr to search for the
first space because sometimes the street number needs to be left blank.
Rather, I need to use a command to cycle the first few characters and tell
if they're numeric or alphabetical, copying them only if they're numeric.
Anyone have any ideas how to do this (i.e. how to tell if they're numeric or
not) or any link that has a little code snippet to do this?
Thanks in advance. | | | | re: Extracting Street Number
Upon closer examination of my data, it appears that there's good news and
bad news. The bad news is that often the street number comes after the
street name, e.g. XYZ Road 3, so I can't just use Val to pick out the first
numerical values from the string, because it will run into the alphabetical
characters first and return a -1.
On the other hand, there are no streets with numbers in them. So I just need
to take all of the numbers in the string (though some may have characters in
the middle, e.g. 13/7, and I want that slash to remain with the numbers) and
store them separately. Any idea how I can do that? How can I pull out just
the part of the string from the first number to the last number?
Thanks again in advance.
"Raphi" <levy@DELETE.THIS.optonline.net> wrote in message
news:ceadj2$84jl$1@netnews.upenn.edu...[color=blue]
> Hi,
>
> I'm trying to clean up a large database in Access. I have one field for
> address, which needs to be broken up into Street Number, Street Name, and
> Street Label (St., Road, etc.)
>
> The problem is that the data is very dirty. So some addresses will be
> standard "456 XYZ Road," while others won't have a number and will just[/color]
say[color=blue]
> "XYZ Industrial Park," meaning I can't just use Instr to search for the
> first space because sometimes the street number needs to be left blank.
> Rather, I need to use a command to cycle the first few characters and tell
> if they're numeric or alphabetical, copying them only if they're numeric.
> Anyone have any ideas how to do this (i.e. how to tell if they're numeric[/color]
or[color=blue]
> not) or any link that has a little code snippet to do this?
>
> Thanks in advance.
>
>[/color] | | | | re: Extracting Street Number
If the 'number substring' contains no embedded spaces, you could scan for
the first numeric char., and the first subsequent space, and take the chars
between as being the street number. I don't know how you can differentiate
the street name and label though. You might have 'Acacia Avenue' or 'The
Poplars'..... And how about named (rather than numbered) addresses?
Dave
"Raphi" <levy@DELETE.THIS.optonline.net> wrote in message
news:ceajf1$3med$1@netnews.upenn.edu...[color=blue]
> Upon closer examination of my data, it appears that there's good news and
> bad news. The bad news is that often the street number comes after the
> street name, e.g. XYZ Road 3, so I can't just use Val to pick out the[/color]
first[color=blue]
> numerical values from the string, because it will run into the[/color]
alphabetical[color=blue]
> characters first and return a -1.
> On the other hand, there are no streets with numbers in them. So I just[/color]
need[color=blue]
> to take all of the numbers in the string (though some may have characters[/color]
in[color=blue]
> the middle, e.g. 13/7, and I want that slash to remain with the numbers)[/color]
and[color=blue]
> store them separately. Any idea how I can do that? How can I pull out just
> the part of the string from the first number to the last number?
> Thanks again in advance.
>
>
> "Raphi" <levy@DELETE.THIS.optonline.net> wrote in message
> news:ceadj2$84jl$1@netnews.upenn.edu...[color=green]
> > Hi,
> >
> > I'm trying to clean up a large database in Access. I have one field for
> > address, which needs to be broken up into Street Number, Street Name,[/color][/color]
and[color=blue][color=green]
> > Street Label (St., Road, etc.)
> >
> > The problem is that the data is very dirty. So some addresses will be
> > standard "456 XYZ Road," while others won't have a number and will just[/color]
> say[color=green]
> > "XYZ Industrial Park," meaning I can't just use Instr to search for the
> > first space because sometimes the street number needs to be left blank.
> > Rather, I need to use a command to cycle the first few characters and[/color][/color]
tell[color=blue][color=green]
> > if they're numeric or alphabetical, copying them only if they're[/color][/color]
numeric.[color=blue][color=green]
> > Anyone have any ideas how to do this (i.e. how to tell if they're[/color][/color]
numeric[color=blue]
> or[color=green]
> > not) or any link that has a little code snippet to do this?
> >
> > Thanks in advance.
> >
> >[/color]
>
>[/color] | | | | re: Extracting Street Number
"Raphi" <levy@DELETE.THIS.optonline.net> wrote in
news:ceadj2$84jl$1@netnews.upenn.edu:
[color=blue]
> Hi,
>
> I'm trying to clean up a large database in Access. I have one
> field for address, which needs to be broken up into Street
> Number, Street Name, and Street Label (St., Road, etc.)
>
> The problem is that the data is very dirty. So some addresses
> will be standard "456 XYZ Road," while others won't have a
> number and will just say "XYZ Industrial Park," meaning I
> can't just use Instr to search for the first space because
> sometimes the street number needs to be left blank. Rather, I
> need to use a command to cycle the first few characters and
> tell if they're numeric or alphabetical, copying them only if
> they're numeric. Anyone have any ideas how to do this (i.e.
> how to tell if they're numeric or not) or any link that has a
> little code snippet to do this?
>
> Thanks in advance.
>[/color]
I can't think of a single valid reason to break up an address field
into street number, street name and street type.
Save yourself a lot of trouble for nothing.
--
Bob Quintal
PA is y I've altered my email address. | | | | re: Extracting Street Number
In message <ceadj2$84jl$1@netnews.upenn.edu>, Raphi
<levy@DELETE.THIS.optonline.net> writes[color=blue]
>Hi,
>
>I'm trying to clean up a large database in Access. I have one field for
>address, which needs to be broken up into Street Number, Street Name, and
>Street Label (St., Road, etc.)
>
>The problem is that the data is very dirty. So some addresses will be
>standard "456 XYZ Road," while others won't have a number and will just say
>"XYZ Industrial Park," meaning I can't just use Instr to search for the
>first space because sometimes the street number needs to be left blank.
>Rather, I need to use a command to cycle the first few characters and tell
>if they're numeric or alphabetical, copying them only if they're numeric.
>Anyone have any ideas how to do this (i.e. how to tell if they're numeric or
>not) or any link that has a little code snippet to do this?[/color]
If you need to do this I would consider multi-pass processing with a
flag field to indicate that the address has been processed. Use a
different value in the flag field for each rule that you apply, that way
you can easily reverse out any errors you discover later.
Look for a series of rules that will each process one format of address,
and then set the flag. The obvious one is where the first token in the
address is a numeric group, extract this and set the flag.
Keep a count of the number of unprocessed records and when this reaches
a manageable level switch to manual processing.
Randomly select a number of the automatically processed addresses for
manual checking.
If you intend to mailshot the people on the list make sure that you ask
for address corrections and return of undeliverable mail, at least for
the first mailshot after you use the new addresses. Expect a higher than
normal number of returns.
--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author. Will work for money. | | | | re: Extracting Street Number
I will break the street name from the street number if I plan to sort by
street names, or look for addresses close by.
Fred Zuckerman
"Bob Quintal" <rquintal@sPAmpatico.ca> wrote in message
news:Xns9535B13D795CBBQuintal@66.150.105.49...[color=blue]
> I can't think of a single valid reason to break up an address field
> into street number, street name and street type.
>
> Save yourself a lot of trouble for nothing.[/color] | | | | re: Extracting Street Number
"Fred Zuckerman" <ZuckermanF@sbcglobal.net> wrote in
news:WGwOc.2377$1Q6.1056@newssvr27.news.prodigy.co m:
[color=blue]
> I will break the street name from the street number if I plan
> to sort by street names, or look for addresses close by.
> Fred Zuckerman
>
>
> "Bob Quintal" <rquintal@sPAmpatico.ca> wrote in message
> news:Xns9535B13D795CBBQuintal@66.150.105.49...[color=green]
>> I can't think of a single valid reason to break up an address
>> field into street number, street name and street type.
>>
>> Save yourself a lot of trouble for nothing.[/color]
>[/color]
Much better to just use the postal code for that.
--
Bob Quintal
PA is y I've altered my email address. | | | | re: Extracting Street Number
Unless you only want 'close' neighbors (about a block)
Postal code would include 1000's of addresses.
Fred
"Bob Quintal" <rquintal@sPAmpatico.ca> wrote in message
news:Xns953710D10FFAEBQuintal@66.150.105.49...[color=blue]
> "Fred Zuckerman" <ZuckermanF@sbcglobal.net> wrote in
> news:WGwOc.2377$1Q6.1056@newssvr27.news.prodigy.co m:
>[color=green]
> > I will break the street name from the street number if I plan
> > to sort by street names, or look for addresses close by.
> > Fred Zuckerman[/color][/color]
[color=blue][color=green]
> > "Bob Quintal" <rquintal@sPAmpatico.ca> wrote in message
> > news:Xns9535B13D795CBBQuintal@66.150.105.49...[color=darkred]
> >> I can't think of a single valid reason to break up an address
> >> field into street number, street name and street type.
> >> Save yourself a lot of trouble for nothing.[/color]
> >[/color][/color]
[color=blue]
> Much better to just use the postal code for that.
> Bob Quintal
>[/color] |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,533 network members.
|