Top |
Post New Question |
Read All |
MP2K Asks Microsoft
701
Greg
-
June 3, 2002
I am currently working with the MapPoint 2002 Trial. I want to utilize MapPoint in an Access database. I can add a MapPoint control to the form and create buttons to do different functions. However, after testing the form, if I go back to design view, I get a message saying "There is no control in this object." and the MapPoint control on my form gets deleted. Any help would be appreciated.
Answers:
June 6, 2002
I'm not familiar with this issue, what version of Access are you using? The trial is fully-functional so there shouldn't be an issue with that.
June 7, 2002
I'm using Access 2002 on a Windows XP machine. I've tried it with and without service pack 1 for Office XP installed.
June 11, 2002
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
June 23, 2002
Me too. I have to be careful to make code changes and save before returning to the form then close the form and then reopen to test.
Post New Answer / Follow-up