anyone knows what the formula is for finding a distance betweeen 2 zip codes?

Aaron

Re: Distance betweeen 2 zip codes by Stan

Stan
Sat Jul 17 17:59:09 CDT 2004

Aaron,

There is no formula for the distance between 2 zip codes. Any system that
provides you with that information has to go to tables containing longitudes
and latitudes and compute the information.

You can, however, use XMLHTTP to query another Web site and return the
information. This routine is written for Office VBA, and can easily be
adapted to script:

Function getDistanceFromZipCodes()
zip1 = InputBox("Enter Zip Code 1, as xxxxx:", "Zip Code 1")
zip2 = InputBox("Enter Zip code 2, as xxxxx:", "Zip Code 2")
If Len(zip1) <> 5 Or Len(zip2) <> 5 Or Not (IsNumeric(zip1)) Or Not
(IsNumeric(zip2)) Then
MsgBox "Each zip code must be 5 digits long and numeric"
Exit Function
End If

sendStr = "http://gazetteer.hometownlocator.com/ZipDistance.cfm?Zip1=" &
zip1 & "&Zip2=" & zip2
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "POST", sendStr, False
xmlhttp.Send ("<dummy/>")
resp = xmlhttp.responseText

begAns = InStr(1, resp, "<strong>") + 8
endAns = InStr(1, resp, "</strong>")
answer = Trim(Mid(resp, begAns, endAns - begAns))
If answer = "5 digit" Then
MsgBox "Distance cannot be determined"
Else
MsgBox "The distance between Zip Code 1 (" & zip1 & ") and Zip Code
2 (" & zip2 & ") is " & answer & " miles"
End If
End Function

Stan Scott
New York City

"Galsaba" <galsaba@aol.com> wrote in message
news:20040717165638.26080.00000026@mb-m28.aol.com...
> anyone knows what the formula is for finding a distance betweeen 2 zip
codes?
>
> Aaron



Re: Distance betweeen 2 zip codes by Aaron

Aaron
Sat Jul 17 18:19:38 CDT 2004

http://www.aspfaq.com/2527

--
http://www.aspfaq.com/
(Reverse address to reply.)





"Galsaba" <galsaba@aol.com> wrote in message
news:20040717165638.26080.00000026@mb-m28.aol.com...
> anyone knows what the formula is for finding a distance betweeen 2 zip
> codes?
>
> Aaron