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 / August 2008

Tip: Looking for answers? Try searching our database.

Access form button that will open a PARTICULAR file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barry - 17 May 2008 02:56 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?  I AM A NOVICE, so please make it simple for me.

All I need is a simple button that can open a PARTICULAR FILE. I will
rewrite other buttons so as to open other files once I’ve been pointed in the
right direction.

Thanks in advance!
billybanter67 - 17 May 2008 06:23 GMT
I use this code to open up a PDF, if you play around you might be able
to addapt this.

Private Sub PDFOpen_Click()
   Dim varRet
   Dim stPath As String
   Dim strJobNumber
   strJobNumber = Me.JobNumber

Set fs = Application.FileSearch
With fs
   .LookIn = Me.PDFDirectory
   .FileName = Me.JobNumber & ".pdf"
   If .Execute > 0 Then
       'MsgBox "There were " & .FoundFiles.Count & _
           '" file(s) found."
       For i = 1 To .foundfiles.Count
           'MsgBox .FoundFiles(I)
           stPath = .foundfiles(i)
           varRet = fHandleFile(stPath, WIN_NORMAL)
       Next i
   Else
       MsgBox "There were no files found."
   End If

End With

Exit_PDFOpen_Click:
   Exit Sub

Err_PDFOpen_Click:

Resume Exit_PDFOpen_Click:

End Sub
Albert D. Kallal - 18 May 2008 09:17 GMT
It takes one line of code.

Use:

   application.FollowHyperlink "path name to file"

So:

   application.FollowHyperlink "c:\Arizona.ptm"

I'm really at a loss as to why people are posting all kinds of complicated
codes and libraries when you can use a simple elegant ONE line of code for
your solution.

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

tish - 12 Aug 2008 20:45 GMT
See, this answer is beautiful to me... And I tried it BUT it's only opening
the folder that the file is in, and not the file/program itself..!? Can
anyone tell me what I'm doing wrong?? Will the code below change if there are
spaces anywhere in the path (folder and file names?) And this should be
pasted into the "event procedure" on click of the button, right?

> It takes one line of code.
>
[quoted text clipped - 9 lines]
> codes and libraries when you can use a simple elegant ONE line of code for
> your solution.
tish - 12 Aug 2008 20:51 GMT
Argh. Power of posting, as they say. I realized I was making a simple/stupid
mistake.

Thanks!!

> See, this answer is beautiful to me... And I tried it BUT it's only opening
> the folder that the file is in, and not the file/program itself..!? Can
[quoted text clipped - 15 lines]
> > codes and libraries when you can use a simple elegant ONE line of code for
> > your solution.
 
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.