Top |
Post New Question |
Read All |
MP2K Asks Microsoft
569
chris
-
January 3, 2002
I have downloaded the database example where you have two addresses in a db and then it calculates and pastes the map and directions back into access but can you just get it to paste the cost of the journey or just the mileage instead of teh directions. Happy New year.
Answer:
To determine cost for a route, you can use the Cost property of the ActiveRoute
object. For example:
'oMap references your current MapPoint Map
MsgBox "The cost for this route is " & oMap.ActiveRoute.Cost
MsgBox "The distance for this route is " & oMap.ActiveRoute.Distance
To programmatically set the driving options, use the Driver Profile object of
the ActiveRoute object. For example:
'Set the DrivingCostUnits to fixed cost based on distance and use
'DrivingCost to set the cost at $.80 per distance unit
objRoute.DriverProfile.DrivingCostUnits = geoCostBasedOnDistance
objRoute.DriverProfile.DrivingCost = 1.25
'Cost in dollars per distance unit. Mostly miles.
objRoute.Calculate 'recalculate the route
You can get more information by opening MapPoint, going to Help, selecting
Visual Basic Reference, and clicking on the ActiveRoute or DriverProfile
objects. - Chris Gebhardt
Post New Answer / Follow-up