Retrieve an External File, pdf, txt, jpeg... etc

M

Michael

I have a generic folder (c:/database/folder/)with a many different files that
need to be referenced on a regular basis. The worst part is finding the file
that is needed. What I am trying to do is to have the user add on a form the
name of the file with the extension (such as .pdf, .doc, .txt, .jpg) where
such information is stored. So lets say as an example that we want to
retrieve the file name adobe.pdf. Using a form, how can I have a pull the
exact file? Again, all files are stored in the same folder and path.

Thanks in advanced!!
 
D

Daniel Pineault

Use the 'standard Windows File Open/Save dialog box' API found at
http://www.mvps.org/access/api/api0001.htm

Then setup a combo box/list box on your form which list the various file
types. Then setup your call to the 'standard Windows File Open/Save dialog
box' to reference the selected file type(s) as the 'ahtAddFilterItem'
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
F

fredg

I have a generic folder (c:/database/folder/)with a many different files that
need to be referenced on a regular basis. The worst part is finding the file
that is needed. What I am trying to do is to have the user add on a form the
name of the file with the extension (such as .pdf, .doc, .txt, .jpg) where
such information is stored. So lets say as an example that we want to
retrieve the file name adobe.pdf. Using a form, how can I have a pull the
exact file? Again, all files are stored in the same folder and path.

Thanks in advanced!!
re: c:/database/folder/
Shouldn't those "/" be "\"?

By "retrieve file name" and "Pull the exact file" I guess you mean to
actually open that file?

Include the actual file names in whatever table is the record source
for the form. Let's call that field "MyDocs".
Store just the actual file name, i.e. Adobe.pdf.

Application.FollowHyperlink "c:\databasefolder\" & Me.[ControlName]

where [ControlName] is the name of the control on the form that is
displaying the name of the [MyDocs] wanted, i.e. Adobe.pdf.
 
M

Michael

Daniel,

Thank you for taking the time to reply. I have the following code:

Private Sub Command5_Click()
Dim wks As Object, name As String
name = Forms![form2]![name]
Set wks = GetObject("C:\client_notes\" & name & ".doc")
wks.Parent.Visible = True
Set wks = Nothing
End Sub

Its simple but its subject to only pulling in a word document. My form will
already have the name of the file when the record is accessed, then all I
need is for the code to pull that file name associated with the record. My
Filename field will have the extension.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top