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

VBA calling MP2k2

This is a discussion on VBA calling MP2k2 within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am trying to give the ability to my user to look up a record in an access form, click ...

  1. #1
    rkehn is offline Junior Member White Belt
    Join Date
    Jan 2003
    Posts
    2

    VBA calling MP2k2

    I am trying to give the ability to my user to look up a record in an access form, click a button and the load the map with that records address. It works fine yet when they switch to a new record and hit the map button again this new adress does goes on the original map, yet another mappoint windows loads. So now I have the two map point windows open the original with two pins and another that is just blank USA. And so on and so forth... 3 different records mapped - 3pins on orig map now two extra windows of map point. I beleive it is my code calling the new window but i just want each new recoard to go onto one map.

    Is there a peice of code that will just add a new pin to the current map.
    How might I referance the original windows/object
    I am not using datasets because I done know what records the user might choose.

    Thanks in advance, Roger

    Here is my code that will run every time the user switches to a new record clicks the map button on the form.

    **************Code*************************




    Dim MPApp As MapPoint.Application
    Set MPApp = CreateObject("MapPoint.Application")
    Set omap = GetObject(, "MapPoint.Application").ActiveMap
    Dim oLoc As MapPoint.Location
    Dim oPin As MapPoint.Pushpin
    Dim StreetAdr As String

    StreetAdr = Me.delivDayAddress + "," + Me.delivDayZip

    omap.FindResults(StreetAdr)(1).Goto
    Set oLoc = omap.FindAddressResults(Me.delivDayAddress, , , , Me.delivDayZip)(1)
    Set oPin = omap.AddPushpin(oLoc)
    oPin.Name = [Forms]![LogCustomer]![FirstName] & " " & [Forms]![LogCustomer]![LastName]
    oPin.BalloonState = geoDisplayBalloon
    oPin.Note = Me.delivDayPhone
    oPin.Symbol = 25

    MPApp.WindowState = geoWindowStateMaximize
    MPApp.UserControl = True
    MPApp.ActiveMap.Saved = True
    MPApp.Visible = True

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Roger,

    On the first go around, MapPoint is not running yet so this part of your code is needed

    Set MPApp = CreateObject("MapPoint.Application")

    If MapPoint is running already this line of code starts another copy.

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Thanks but one quick question

    Is there a line of code that can see if it is already loaded once?

    Thanks again for the quick responce!

    Rog

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calling all Micro-ISVs!
    By Winwaed in forum General Chat
    Replies: 2
    Last Post: 05-05-2006, 11:16 AM
  2. AGPS in MP2k2 shows wrong long/lat but yet plots correct pos
    By Jamez_Warner in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-17-2003, 09:18 AM
  3. 911 outbound calling
    By LLurie in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 04-21-2003, 09:41 AM
  4. mp2k2 Fleet Applications
    By Clyde in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-11-2003, 08:48 PM
  5. I wonder if there is a way to import MP2k2 data in....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-20-2001, 07:34 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83