Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open files stored as filepath 1

Status
Not open for further replies.

snuffi01

Technical User
May 24, 2003
26
SE
I have a form where i store filepaths by clicking an button and browse to an file and save it.
Then i display the records in an subform.
Now i want to double click an the field of one of the records in the subform and open the file of that record.
I have tried the fHandleFile function that i have found here at this side.
But i dont get it to work!
I want to be able to open all sorts of files that i store in my records.
Please help!
 
The easiest way is to use:

Application.FollowHyperlink path-to-file
which will open it in the default application for that particular file type.

eg
Application.Followhyperlink "C:\My Documents\filename.doc"

or

Application.FollowHyperlink "
You can replace the first parameter with the name of the control that your path is located in.

John
 
Can you create a hyperlink field in your table for that record? Create a new field withe datatype Hyperlink. Go to design view, click in the field and then click Insert, Hyperlink. Click on Existing File or Web Page and where is says Type the File, type in the pathname with file name. eg. C:\powerpoint tricks.doc
If you want to open a table in the database, click Insert, Hyperlink, Object in This Database then click on the + sign next to Tables and select your table.
Now when you click on the pathname or table name, it opens up the file.

Neil
 
Fneily,

Another way around it is to have a text field with the path and filename, and a button "Open file" with the following code (assuming it is in txtPath)

Code:
If Len (Me!txtPath & "") > 0 Then
  Application.FollowHyperlink Me!txtPath
Else
  Msgbox "No path to run", vbInformation+vbOkOnly
End If

John
 
Again, Mr. BillPower and JrBarnett expand my knowledge and usefulness for my students.
Thanks

Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top