Access: Opening a file path stored in a text field from a form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to store the logical path to a file in a table, and then from a
form have a command button open this logical path. Specifically I am trying
to store imaged documents in PDF version on a file sever, and then using this
logical path as a means to access them. Any ideas on the code for the command
button to make it do this. I might add that the table is in a SQL server, and
therefore does not have a field type similar to the hyperlink one in Access.
With the number of PDF documents we are talking about, Access as a solution
for storage is out of the question.
 
If the full path to the file is stored in variable strFilePath, you can use

Application.FollowHyperlink strFilePath

to open the document.
 
Douglas,

The timing of your response was uncanny. Wonder if somebody else is working
on the same thing I am!

My question is similar, but yielding 2 issues.

1. The command you reference below works great with MS Word, but ONLY WORKS
for PDF files if Acrobat is already open. Any ideas why that is? I need
this to open Adobe and the pdf file.

2. What I really need is to open a number of files using a wildcard
approach, such a filename*.pdf. Any ideas on how to accomplish this?
 
Douglas,

Skip #1 below, as it was an issue of having Adobe Reader 6.0 and Adobe
Acrobat 7.0 on the computer. I removed Reader 6.0 and all is good.

If you know of a method to do a group read/wildcard per #2 below, I would
appreciate it.

Thanks.
 
If all your files are in a single folder, you could do something like:

Dim strFolder As String
Dim strFile As String

strFolder = "C:\MyFolder\"
strFile = Dir(strFolder & "*.pdf")
Do While Len(strFile) > 0
Application.FollowHyperlink strFolder & strFile
strFile = Dir()
Loop

If you want to present the standard Windows File Open dialog and let your
users select multiple files to open from that dialog, post back. It's not
difficult, but I don't know a good example posted anywhere on the web, and
there's no point typing it out if you're not interested! <g>
 
Back
Top