Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post Codes 1

Status
Not open for further replies.

Katana2003

Programmer
Jun 25, 2003
23
GB
I work for a company that sales trailers with multiple depots and I want to be able to find the nearest depot from any ware in the country preferably by using post codes is there any way of doing this.

Thanks

 
Katana,

I built a table with all the locations. Each record in that table was
LocName as text
DistNorth as double
DistEast as double

The on a form which is bound to the table with no fields on the form. I put two combo boxes cboStart and cboFinish

Then a cmd button with CALC and the following code:

***************** code *************
Private Sub cmdCalc_Click()
Dim d1, d2, d1s As Double

If IsNull(Me.cboStart) Or IsNull(Me.cboFinish) Then Exit Sub

d1 = Me.cboStart.Column(2) - Me.cboFinish.Column(2)
d2 = Me.cboStart.Column(3) - Me.cboFinish.Column(3)

d1s = Sqr(d1 * d1 + d2 * d2)
d1s = Int(d1s * 10) / 10
Me.Text14 = d1s

End Sub
************** end code **************
You pick a starting place and give it 0,0 north and east dimensions. All other places have a fiinite nort and east distance. I would use tenths of a mile. Get it off a map for instance - just approx. Now you can calc any dist bewteen any place inasmuch as the names and the distances are available in the combo boxes.

If you see this, you can do what you want.

Rollie E

If you want a zipped copy of the mdb, emial me at

rollie@bwsys.net

 
Here in the UK, I use a database produced by Geoplan (see in conjunction with the Royal Mail. This will list the postcodes down to whatever level you specify (and pay for!). It then gives an X and Y coordinate of the centre of the post code point, which is the distance in metres from Lands End, Cornwall. A simple bit of Pythagoras will give you the distance between any two points, trignometry will give you the direction too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top