If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Open program file via access form button
Thanks for the help. I don't think my earlier question was clear enough. I
have a microsoft mapping program called MapPoint. It resides in C:\Program Files\MapPoint. From that Mapping program I have made various Map Files: MyMap.ptm, Arizona.ptm, PA.ptm, California.ptm, etc. the path to these files are c:\MyMap.ptm, c:\Arizona.ptm, etc. How do I make a button for each file that will open them? Example a button to open MyMap, another button to open Arizona, etc. Every thing I have tried so far only opens the executable MapPoint Program. I'd like to open particular files. Can anyone help Please? Thanks in advance |
#2
|
|||
|
|||
Open program file via access form button
You can use ShellExecute to open a file:
http://www.mvps.org/access/api/api0018.htm But I'll do you 1 better. MapPoint is a Microsoft Office VBA client. Here's some code that will open a map inside an Access form and plot a map with directions between 2 addresses. The map is displayed in a Bound Object frame (objMap): Private Sub cmdMap_Click() Dim oApp As Object Dim oMap As Object Dim oPush(1 To 2) As Object Dim oLoc(1 To 2) As Object Set oApp = CreateObject("Mappoint.Application") Set oMap = oApp.NewMap Set oLoc(1) = oMap.Find(Address & " , " & City & " , " & State) Set oLoc(2) = oMap.Find(Address2 & " , " & City2 & " , " & State2) If Not oLoc(1) Is Nothing Then Set oPush(1) = oMap.AddPushpin(oLoc(1)) oPush(1).GoTo If Not IsNull(MyName) Then oPush(1).Name = MyName oPush(1).Highlight = True If Not oLoc(2) Is Nothing Then Set oPush(2) = oMap.AddPushpin(oLoc(2)) oPush(2).Highlight = True With oMap.ActiveRoute .Waypoints.Add oLoc(1) .Waypoints.Add oLoc(2) .Calculate End With oMap.CopyDirections DoEvents Me.txtDir.SetFocus DoCmd.RunCommand acCmdPaste Else txtDir.SetFocus txtDir.Text = "No second location found!" End If oMap.DataSets(1).ZoomTo oMap.CopyMap objMap.Visible = True objMap.Action = acOLEPaste lblMapInfo.Caption = "" Else lblMapInfo.Caption = "Address Not Found!" End If Set oMap = Nothing Set oApp = Nothing Me.SetFocus End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "Barry" wrote in message ... Thanks for the help. I don't think my earlier question was clear enough. I have a microsoft mapping program called MapPoint. It resides in C:\Program Files\MapPoint. From that Mapping program I have made various Map Files: MyMap.ptm, Arizona.ptm, PA.ptm, California.ptm, etc. the path to these files are c:\MyMap.ptm, c:\Arizona.ptm, etc. How do I make a button for each file that will open them? Example a button to open MyMap, another button to open Arizona, etc. Every thing I have tried so far only opens the executable MapPoint Program. I'd like to open particular files. Can anyone help Please? Thanks in advance |
Thread Tools | |
Display Modes | |
|
|