Hello,
I have an ACCESS-table with maybe 30 addresses and would like to optimize and calculate a route with VB. Has anyone an idea?
Thanks
Ralf
This is a discussion on Optimize and calculate a Route within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hello, I have an ACCESS-table with maybe 30 addresses and would like to optimize and calculate a route with VB. ...
Hello,
I have an ACCESS-table with maybe 30 addresses and would like to optimize and calculate a route with VB. Has anyone an idea?
Thanks
Ralf
I found it by myself:
Private Sub Befehl0_Click()
Dim objApp As MapPoint.Application
Dim objMap As MapPoint.MAP
Dim objRoute As MapPoint.Route
Dim db As Database, rs As Recordset, i As Integer, Status As String
Set db = CurrentDb
Set rs = db.OpenRecordset("KundenXLS")
'Anwendung einrichten
Set objApp = CreateObject("mappoint.application")
Set objMap = objApp.ActiveMap
Set objRoute = objMap.ActiveRoute
objApp.Visible = True
objApp.UserControl = True
'Route erstellen und optimieren
With objRoute.Waypoints
do until rs.eof
.Add objMap.FindAddressResults(rs!Straße, rs!Ort, , , rs!Plz, geoCountryGermany).Item(1)
rs.MoveNext
Loop
End With
objRoute.Waypoints.Optimize
MsgBox "Die Route wurde optimiert"
objRoute.Calculate
End Sub
It works fine but is there also a way to get back to ACCESS the distances from every point to the next?
Thanks to everyone
Ralf
There is an itenary collection that gives you more information on each segment including time and distance.
Back to the route optimize method, do you know of a similar method in mappoint 2003 (web service ) ???
Regards,
Rasmeek
There are currently 1 users browsing this thread. (0 members and 1 guests)