Using Hyperlinks stored in Database Table

  • Thread starter Thread starter Jim Shaw
  • Start date Start date
J

Jim Shaw

RE: Access 2003. I have a table with a column containing Adobe.PDF
document names. Each row in the table will have a different name. For
example "OilMDSS.pdf". I want to create a command button on a form that
will open that document. Can someone give me a code snippet for the
On_click event for the control that will open this document. If it can't be
done there, is such a capability available in Access 207?

As a fall back, I know how to open an MS.Word application, but I don't know
how to pass the document name to Word so it will open the document upon
initiation. That would give me a work-a-round. A hyperlink to an html
document would work, but from the perspective of the form, the links are
dynamic.

Thanks
Jim
 
RE: Access 2003. I have a table with a column containing Adobe.PDF
document names. Each row in the table will have a different name. For
example "OilMDSS.pdf". I want to create a command button on a form that
will open that document. Can someone give me a code snippet for the
On_click event for the control that will open this document. If it can't be
done there, is such a capability available in Access 207?

As a fall back, I know how to open an MS.Word application, but I don't know
how to pass the document name to Word so it will open the document upon
initiation. That would give me a work-a-round. A hyperlink to an html
document would work, but from the perspective of the form, the links are
dynamic.

Thanks
Jim

Unless ALL of the documents are in the same folder, you need to also
store the path to the document, either in a separate field, or include
it in with the DocName field.

Assume that the path to each document is different and you store the
path separate from the DocName.
[PathField] stores "c:\MyFolder"
[DocName] stores "MyDoc.pdf"

Then you can use:
Application.FollowHyperlink [PathField] & "\" & [DocName]

However, if you store the path and name in the same field...
[DocName] stores "c:\MyFolder\MyDoc.pdf"

Then use:

Application.FollowHyperlink [DocName]

If all of the documents are in the same folder...
[DocName] stores "MyDoc.pdf"
No need for the [PathField] field.

Then use:
Application.FollowHyperlink "c:\MyFolder\" & [DocName]
 
Thanks Fred.
It works!
Jim

fredg said:
RE: Access 2003. I have a table with a column containing Adobe.PDF
document names. Each row in the table will have a different name. For
example "OilMDSS.pdf". I want to create a command button on a form that
will open that document. Can someone give me a code snippet for the
On_click event for the control that will open this document. If it can't
be
done there, is such a capability available in Access 207?

As a fall back, I know how to open an MS.Word application, but I don't
know
how to pass the document name to Word so it will open the document upon
initiation. That would give me a work-a-round. A hyperlink to an html
document would work, but from the perspective of the form, the links are
dynamic.

Thanks
Jim

Unless ALL of the documents are in the same folder, you need to also
store the path to the document, either in a separate field, or include
it in with the DocName field.

Assume that the path to each document is different and you store the
path separate from the DocName.
[PathField] stores "c:\MyFolder"
[DocName] stores "MyDoc.pdf"

Then you can use:
Application.FollowHyperlink [PathField] & "\" & [DocName]

However, if you store the path and name in the same field...
[DocName] stores "c:\MyFolder\MyDoc.pdf"

Then use:

Application.FollowHyperlink [DocName]

If all of the documents are in the same folder...
[DocName] stores "MyDoc.pdf"
No need for the [PathField] field.

Then use:
Application.FollowHyperlink "c:\MyFolder\" & [DocName]
 
Back
Top