A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open program file via access form button



 
 
Thread Tools Display Modes
  #1  
Old May 13th, 2008, 03:28 AM posted to microsoft.public.access.forms
BARRY
external usenet poster
 
Posts: 383
Default 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  
Old May 13th, 2008, 04:37 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP]
external usenet poster
 
Posts: 4,231
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.