M
Marc
Hi, the below code adds a pushpin to a mappoint map and works fine
--except for the last part which should connect the points with a
line..I believe i am calling the 'objloc' incorrectly.
Any ideas?
Sub MapSelectedProperties()
Dim db As Database
Dim rstProps As Recordset
Dim objLoc As MapPoint.Location
Dim objMap As MapPoint.Map
Dim objPushpin As MapPoint.Pushpin
Dim strMsg As String
Dim i As Integer
i = 0
Set db = CurrentDb()
'Load the selected properties into a recordset
Set rstProps = db.OpenRecordset("SELECT * FROM tblProperties WHERE
ysnSelected = Yes;")
'Make sure at least one property was selected
If rstProps.RecordCount > 0 Then
'Load Map
If LoadMap() Then
'Open the form containing the map
FormOpen "frmMap"
Set objMap = gappMP.ActiveMap
'Place a pushpin on the map for each selected property
While Not rstProps.EOF
i = i + 1
Set objLoc = objMap.FindAddressResults(rstProps!strStreet,
rstProps!strCity, rstProps!strState, rstProps!strPostalCode)(1)
Set objPushpin = objMap.AddPushpin(objLoc, rstProps!strStreet)
objPushpin.Name = CStr(i)
objPushpin.Note = "$" & rstProps!curListPrice
objPushpin.BalloonState = geoDisplayBalloon
objPushpin.Symbol = 77
objPushpin.Highlight = True
rstProps.MoveNext
Wend
-------------------------------------------------------------------------------------
Dim oShp As MapPoint.Shape
Set oShp = objMap.Shapes.AddPolyline(Array(objLoc))
oShp.Name = "test"
oShp.SizeVisible = True
---------------------------------------------------------------------------------------
--except for the last part which should connect the points with a
line..I believe i am calling the 'objloc' incorrectly.
Any ideas?
Sub MapSelectedProperties()
Dim db As Database
Dim rstProps As Recordset
Dim objLoc As MapPoint.Location
Dim objMap As MapPoint.Map
Dim objPushpin As MapPoint.Pushpin
Dim strMsg As String
Dim i As Integer
i = 0
Set db = CurrentDb()
'Load the selected properties into a recordset
Set rstProps = db.OpenRecordset("SELECT * FROM tblProperties WHERE
ysnSelected = Yes;")
'Make sure at least one property was selected
If rstProps.RecordCount > 0 Then
'Load Map
If LoadMap() Then
'Open the form containing the map
FormOpen "frmMap"
Set objMap = gappMP.ActiveMap
'Place a pushpin on the map for each selected property
While Not rstProps.EOF
i = i + 1
Set objLoc = objMap.FindAddressResults(rstProps!strStreet,
rstProps!strCity, rstProps!strState, rstProps!strPostalCode)(1)
Set objPushpin = objMap.AddPushpin(objLoc, rstProps!strStreet)
objPushpin.Name = CStr(i)
objPushpin.Note = "$" & rstProps!curListPrice
objPushpin.BalloonState = geoDisplayBalloon
objPushpin.Symbol = 77
objPushpin.Highlight = True
rstProps.MoveNext
Wend
-------------------------------------------------------------------------------------
Dim oShp As MapPoint.Shape
Set oShp = objMap.Shapes.AddPolyline(Array(objLoc))
oShp.Name = "test"
oShp.SizeVisible = True
---------------------------------------------------------------------------------------