View Single Post

  #4 (permalink)  
Old 06-03-2002
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Greg, I had the same problem. Have you overcome it yet?

I used a code sample which works with an image control on the Access form, pasting the contents of a MapPoint Object into the image.

Email me for further info or to share progress at wellermatt@hotmail.com.

Code Sample (sorry it is untidy!):

Private Sub Form_Load()

SetObjects
ReloadMap ("None")

End Sub

Sub SetObjects()

Set oApp = CreateObject("Mappoint.Application")
Set oMap = oApp.OpenMap("c:\matt\renault\CUstom Territories.ptm") 'Create a new map

End Sub
Sub ReloadMap(PCode)

Dim oPush As Object, oLoc As Object

Set oLoc = oMap.Find(PCode)

'get address from PostCode

If Not oLoc Is Nothing Then 'Check to see if the first address was found.
Set oPush = oMap.AddPushpin(oLoc) 'Place a pushpin on the map
'add some more details to the pushpin and display the balloon
oPush.BalloonState = geoDisplayBalloon
oMap.ZoomIn
oPush.Goto
oMap.Saved = True
'Zoom in so that the entire map with directions is viewed
oMap.CopyMap 'Copy the map to the clipboard
img.Visible = True 'Change the image place holder in the Access form to visible
img.Action = acOLEPaste
End If

End Sub


Sub RefreshMap()
oMap.Saved = True
'Zoom in so that the entire map with directions is viewed
oMap.CopyMap 'Copy the map to the clipboard
img.Visible = True 'Change the image place holder in the Access form to visible
img.Action = acOLEPaste
End Sub


Private Sub cmdPanEast_Click()
oMap.Pan (geoEast)
RefreshMap
End Sub


Private Sub cmdPanNorth_Click()
oMap.Pan (geoNorth)
RefreshMap
End Sub


Private Sub cmdPanSouth_Click()
oMap.Pan (geoSouth)
RefreshMap
End Sub


Private Sub cmdPanWest_Click()
oMap.Pan (geoWest)
RefreshMap
End Sub


Private Sub cmdZoomIn_Click()
oMap.ZoomIn
RefreshMap
End Sub


Private Sub cmdZoomOut_Click()
oMap.ZoomOut
RefreshMap
End Sub



Reply With Quote