how to view and open pdf from my form?

J

jmuirman

My form shows parties to various claims among other information. Let's say I
have written 5 letters on this file and stored same in My Documents. I would
like to see the hyperlinks to the documents within my form and be able to
double click on any of my letters to view or print same.

Any ideas? Do I need a sub-form?

Thanks,

John
 
O

Ofer Cohen

You can use the FollowHyperLink, it will open any file with the program
assocuated with it in windows

Application.FollowHyperLink "File Path and name"

e.g

Application.FollowHyperLink "c:\Filename.pdf"

*************************
If you have the file name in a text box
Application.FollowHyperLink "c:\" & Me.[TextBoxName]

*************************
If the location and the file name is in one text box
Application.FollowHyperLink Me.[TextBoxName]
 
S

Scott McDaniel

My form shows parties to various claims among other information. Let's say I
have written 5 letters on this file and stored same in My Documents. I would
like to see the hyperlinks to the documents within my form and be able to
double click on any of my letters to view or print same.

How are you storing the links to your documents? I'd presume you have a separate table that relates the "main" document
(i.e. your Access record) with the PDF files? This is normally done by storing the PDF file's full address, then using
the Hyperlink method (as Ofer described) to do this.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
J

jmuirman

Here is what I do: I print a Word Doc to pdf and save it in "My Documents"
like -- Letter1.pdf, Letter2.pdf etc.

From my db, I want to open my form and (1) see that I have 2 letters, (2)
then be able to double click, say Letter2.pdf and view same.

Also, I am not sure what to do with - Application.FollowHyperLink
"C:\Documents \My Documents". When I open a command button, it asks if I want
to run an application etc., what do I choose here? Or in the alternative,
where do I pasete the followhyperlink code to?

Thanks,

John
 
P

Peter Hibbs

John,

Another alternative is to have a List box on your form which shows a
list of files in your PDF folder (filtered on .pdf if you want) and
then you can click on a file in the list to open the document file
using the ShellExecute function at
http://www.mvps.org/access/api/api0018.htm

I have made a small mdb file (Access 2000) with a form and module
which will do this. If you would like a copy then email me at
[email protected] (leave off the NOSPAM bit) and I will
send it on.

Peter Hibbs.
 
S

Scott McDaniel

Here is what I do: I print a Word Doc to pdf and save it in "My Documents"
like -- Letter1.pdf, Letter2.pdf etc.

From my db, I want to open my form and (1) see that I have 2 letters, (2)
then be able to double click, say Letter2.pdf and view same.

Okay, but how does Access know that Letter1.pdf and Letter2.pdf "belong" to the record you're currently viewing? Or does
that matter? If it does, then somehow you'd need to associate the two PDF files with the correct record in Access.

In other wods, when your fire up your form, and you're viewing the first record, do you want ALL .pdf files in the My
Documents directory to be available, or do you want to see a list of ONLY those files that are associated with the first
record ... then when you move to the second record, you want to see those files associated with the second record, and
so on and so on ... if that's the case, then you'll need a table to store this relationship.
Also, I am not sure what to do with - Application.FollowHyperLink
"C:\Documents \My Documents". When I open a command button, it asks if I want
to run an application etc., what do I choose here? Or in the alternative,
where do I pasete the followhyperlink code to?

Take a look at the post by Peter ... I much prefer using ShellExecute to do these types of things, and Peter has
provided a sample for you to review ... perhaps this would be simpler.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
T

Taylor Mobley

ggyygygyggyy556677yyuujjkk
vvg554



John,

Another alternative is to have a List box on your form which shows a
list of files in your PDF folder (filtered on .pdf if you want) and
then you can click on a file in the list to open the document file
using the ShellExecute function at
http://www.mvps.org/access/api/api0018.htm

I have made a small mdb file (Access 2000) with a form and module
which will do this. If you would like a copy then email me at
[email protected] (leave off the NOSPAM bit) and I will
send it on.

Peter Hibbs.
 
Top