Select closest match query

shiv_379

Registered User.
Local time
Today, 00:59
Joined
May 7, 2004
Messages
13
Greetings all!
I am working on something and it has me stumped. Basically I have a list of Eastings and Northings and I am trying to find the closest postcode centroid based on the PAF file (for those that do not know of the PAF file, it contains a list of postcodes and the easting and northing of the centroid).
The best way that I can see of doing this is:
For each record I am trying to match, calculate the distance from the Easting,Northing to every easting,northing in the PAF.
Select Min(Straight Line Distance) from the results.

However I do not know how to do this without matching each record that I am looking at individually! Can anyone give me an idea of how I can put this query together?
I am using MS Access :(

Thanks!
~Shiv
 
Could you explain how postcodes work?

I live in Canada so we have postal codes
IE) K6V 6L9

So I don't exactly know how yours would work.

Sounds like the easiest way to accomplish what you're trying to do would be to use an array with all post codes and compare them with the one you have

start by making the first item in the array into a variable IE) StrClosest

everytime the array goes through, it will compare to that value, and if the value is closer, it will replace it
 

Users who are viewing this thread

Back
Top Bottom