Hello Everyone,
I am working with a set of waypoints in VBA. I am collecting the waypoint order and am preparing to update my Access database. I have recorded the stop order and can recover the itineray line with this code:
MsgBox (objmap.ActiveRoute.Waypoints.Item(stop).name & " -" & objmap.ActiveRoute.Waypoints.Item(stop).PreferredA rrival)
but there does not seem to be a way to return the time for that waypoint.
has anyone figured out how to get that data?
PS (objmap.ActiveRoute.Directions.Item(stop).Preferre dArrival) returns 12:00 PM by default but does not return the calculated arrival time.
Thanks for your help
Randye
CSG
this line returns the first driving direction for the waypoint.
MsgBox (objmap.ActiveRoute.Directions.Item(stop).instruct ions)
Randye
CSG
Found it
MsgBox (objmap.ActiveRoute.Waypoints.Item(stop).name & " -" & objmap.ActiveRoute.Directions.Item(stop).StartTime )
Randye
CSG
Anonymous
06-23-2004, 11:12 AM
This is great, but exactly what is "stop"?
I am having a tough time identifying the direction instruction that correalates to the waypoint.
Hello,
This VBA code reads the directions created by mappoint and updates a table in ms access s= directions counter and stops = waypoint item
I hope this will answer your question.
Private Sub WAYPOINT_Click()
On Error GoTo err_wp_CLICK
Dim objMap As MapPoint.Map
Set objMap = Forms!MAPPLAN.csgmAP.ActiveMap
Dim objLoc As MapPoint.location
Dim objpushPin As MapPoint.Pushpin
Dim na As String
Dim ti As Date
Dim s As Integer
Dim STOPS As Integer
Dim last As Integer
Dim mi As String
STOPS = 1
last = objMap.ActiveRoute.directions.count
s = 1
DoCmd.SetWarnings False
DoCmd.OpenQuery "gpsclearroute"
loopstops:
na = objMap.ActiveRoute.Waypoints.Item(s).name
ti = objMap.ActiveRoute.directions.Item(STOPS).StartTim e
If objMap.ActiveRoute.directions.Item(STOPS).Distance = 0 Then mi = 0 Else mi = Format(CDbl(objMap.ActiveRoute.directions.Item(STO PS).Distance), "#.#")
'MsgBox (s & "--" & na & " -- Dir: " & STOPS & " -- Time: " & ti & " -- TURNS: " & di)
If mi = "." Then Me!mi = 0 Else Me!mi = mi
Me!wp = s
Me!ti = ti
Me!na = na
Me!st = STOPS
Me!di = di
di = objMap.ActiveRoute.directions.Item(STOPS).instruct ion & " for " & Me!mi & " miles"
Me!wa = objMap.ActiveRoute.Waypoints.Item(s).StopTime * 1440
Me!arr = (objMap.ActiveRoute.Waypoints.Item(s).PreferredArr ival)
DoCmd.OpenQuery "gpsbuildroute"
If STOPS >= last Then GoTo display
STOPS = STOPS + 1
If na <> objMap.ActiveRoute.directions.Item(STOPS).WAYPOINT .name Then s = s + 1
If STOPS <= last Then GoTo loopstops
display:
DoCmd.OpenQuery "gpsrouteend"
DoCmd.OpenQuery "makegpstemp"
DoCmd.OpenQuery "gpsplotupdate"
DoCmd.SetWarnings True
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "poproute"
'stLinkCriteria = "[route]=" & "'" & Me![mname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
err_wp_CLICK:
End Sub
CSG