I am currently creating an Access project where we can click a button next to a customer record and it will bring up a map of where there are and show our local stores.
So far i have it so that Access opens the map file in mappoint and then gets the handle of the map and puts it into another form (frmMap). This all works fine however the FindAddressResults and AddPushpin do not work, indeed they appear to do nothing!
I had this working previously but I was then required to OpenMap as we needed to use a previously worked on map rather than a blank one. Since putting in the OpenMap it hasn't worked.
I would be very gratefull for any ideas you may have.
Thanks in advance for your help.
This is the code I have currently as my OnClick event
'Map the selected properties
On Error GoTo MapSelectedProperties_Err_Exit
Dim objLoc As MapPoint.Location
Dim objMap As MapPoint.Map
Dim objPushpin As MapPoint.Pushpin
Dim PCode As String
Dim strMsg As String
Set gappMP = CreateObject("MapPoint.Application")
gappMP.Visible = True
gappMP.PaneState = geoPaneNone
'Get the handle of the MapPoint Window
ghwndMP = FindWindow(vbNullString, "Bells.Ptm - Microsoft MapPoint Europe")
'Remove MapPoint Title Bar
FlipBit ghwndMP, WS_CAPTION, False
'Open the form containing the map
PCode = Left(Me!PostCode, 5)
'Place a pushpin on the map for each selected property
Set objLoc = objMap.FindAddressResults(Me!Street, Me!Village, Me!Town, , PCode)(1)
Set objPushpin = objMap.AddPushpin(objLoc, Me!Street)
objPushpin.Name = Me!Street
objPushpin.Note = Me!Forenames & " " & Me!Surname
objPushpin.BalloonState = geoDisplayBalloon
objPushpin.Symbol = 77
objPushpin.Highlight = True
'Show all pushpins on the map display
On Error Resume Next
Set objPushpin = Nothing
Set objLoc = Nothing
Set objMap = Nothing