The more accurate query for distances by zip code will not work with Access. Here is an alternative query that will:


Given you know the latitude and longitude of the origin zipcode and radius:


  SELECT ZIPCODE, SQR(69.1 * (Latitude - #origin.Latitude#) * 69.1 * (Latitude - #origin.Latitude#) + 69.1 * (Longitude - #origin.Longitude#) * cos(#origin.Latitude# / 57.3) * 69.1 * (Longitude - #origin.Longitude#) * cos(#origin.Latitude# / 57.3)) AS Distance
  FROM ZipCodes
  WHERE SQR(69.1 * (Latitude - #origin.Latitude#) * 69.1 * (Latitude - #origin.Latitude#) + 69.1 * (Longitude - #origin.Longitude#) * cos(#origin.Latitude# / 57.3) * 69.1 * (Longitude - #origin.Longitude#) * cos(#origin.Latitude# / 57.3)) <= #Attributes.Radius#


You'll find a full explaination of calculations at:


http://www.meridianworlddata.com/distance-calculation.asp


-- Muzlhed

Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to