Command Button to Open EXTERNAL file (any kind)

G

Guest

I have a database with employee information and I use a form called EMPINFO.
I have scanned 5 pages of information for each employee which I have them on
PDF format on a separate drive. Each employee on the form has a unique number
(primary key).

- I want to be able to have a command button, that will open the PDF file of
that specific employee. I tried doing it with reports but it is being too
time consuming. Basically the command button needs to run a query that will
select the employee number currently on screen, and it will open the PDF file
of that employee! Please help.

I know how to do hyperlinks with the command buttons, but it would be too
many buttons if I have to add one command button for each employee with a
hyperlink.
 
A

Albert D.Kallal

You can launch any file as if you clicked on it by using:


application.FollowHyperlink "c:\docuemnts\test.doc"

or

application.FollowHyperlink "c:\docuemnts\test.pdf"

So, just use a buttion with some code:

application.FollowHyperlink me!FieldNameWithdocumentpath
 
G

Guest

Yes, each PDF file has the employee number as the file name. So the File Key
is always the same as the PDF file name.
 
R

Rick Brandt

DavidGuaman said:
I have a database with employee information and I use a form called
EMPINFO. I have scanned 5 pages of information for each employee
which I have them on PDF format on a separate drive. Each employee on
the form has a unique number (primary key).

- I want to be able to have a command button, that will open the PDF
file of that specific employee. I tried doing it with reports but it
is being too time consuming. Basically the command button needs to
run a query that will select the employee number currently on screen,
and it will open the PDF file of that employee! Please help.

I know how to do hyperlinks with the command buttons, but it would be
too many buttons if I have to add one command button for each
employee with a hyperlink.

Are the PDF files consistently named such that the only thing different is
the inclusion of the employee number in the file name? If so...

Application.FollowHyperlink "PathToPDFFolder" & Me.EmployeeNumber & ".PDF"
 

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