Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Open program file via access form button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barry - 13 May 2008 03:28 GMT
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
Arvin Meyer [MVP] - 13 May 2008 04:37 GMT
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
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> Thanks for the help.  I don't think my earlier question was clear enough.
> I
[quoted text clipped - 16 lines]
>
> Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.