Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

Adding pushpins and viewing map from access project

This is a discussion on Adding pushpins and viewing map from access project within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am currently creating an Access project where we can click a button next to a customer record and it ...

  1. #1
    Dazzer is offline Senior Member Green Belt
    Join Date
    Sep 2003
    Posts
    103

    Adding pushpins and viewing map from access project

    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.

    Dazzer

    This is the code I have currently as my OnClick event

    Sub MapSelectedProperties()
    '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.OpenMap ("Q:\BellsMapTest\Bells.ptm")
    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
    FormOpen "frmMap"


    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
    objMap.DataSets.ZoomTo


    MapSelectedProperties_Err_Exit:
    On Error Resume Next
    Set objPushpin = Nothing
    Set objLoc = Nothing
    Set objMap = Nothing

    Exit Sub
    MapSelectedProperties_Err:
    MsgBox Err.Description
    Resume MapSelectedProperties_Err_Exit
    End Sub

  2. #2
    huggesc is offline Junior Member White Belt
    Join Date
    Nov 2003
    Posts
    4

    Adding pushpins and viewing map from access project

    I'm having the same problem with OpenMap. If I only use a Create Object I get a new map and it loads to a MSAccess form. If I use the OpenMap to select a map that I have updated or worked on
    ie: "C:\anydirectory\any.ptm" Mappoint starts a new instance outside of the MSAccess Application that I'm running. If anyone has any solutions or links to code that would solve this problem it would be greatly appreciated.

  3. #3
    Dazzer is offline Senior Member Green Belt
    Join Date
    Sep 2003
    Posts
    103
    I solved this problem, my mistake was using OpenMap, I should have used NewMap

    Code:
    Dim gappmp As New Mappoint.Application
     Dim objMap As MapPoint.Map
    
      Set gappmp = CreateObject("MapPoint.Application")
      
        gappmp.NewMap "C:\AMap.ptm"
        gappmp.Visible = False
        'gappmp.UserControl = True
        gappmp.PaneState = geoPaneNone
    
        Set objMap = gappmp.ActiveMap

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Adding Pushpins from Excel 2003
    By Marktherob in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 02-07-2006, 06:13 PM
  2. Adding pushpins by lat/long or address using MPC in MSAccess
    By GM in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-01-2004, 01:00 PM
  3. Adding custom pushpins to the pushpin selection
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-28-2003, 04:28 PM
  4. Adding Pushpins
    By Matrices in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-28-2003, 11:32 AM
  5. Is there a fast way of adding pushpins?
    By matt1168 in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 07-24-2003, 10:44 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25