Hardcoding Network Path and extension for use with hyperlink

  • Thread starter KFox via AccessMonster.com
  • Start date
K

KFox via AccessMonster.com

I have a table with a file name field (for a pdf file), but the file name is
only the name of the field-- it doesn't include the network path of where the
file is stored, nor does it include the .pdf extension. How could I include
the network path and extension when setting up the code for this text so it
works as a hyperlink?

I haven't written any of the code yet, so not sure exactly how to even do
this. I need the field to remain a text field-- I can't change it to a
hyperlink format.

Thank you VERY much!

Kellie
 
J

JConsulting

Dim rs as DAO.Recordset
Dim strHyper as string
currentdb.openrecordset("Select filename from yourtable")
if rs.EOF then exit sub
rs.movefirst
strHyper = "//myserver/mydirectory/" & rs!filename & ".pdf"
followhyperlink strHyper

another option is to build a similar string from a form...with your table as
it's recordsource.
create an unbound textbox that builds the string
then on the click event of the textbox
use the FollowHyperlink command to launch your PDF.

J
 
K

KFox via AccessMonster.com

Thanks "J"-- I'll give this a shot!

Kellie
Dim rs as DAO.Recordset
Dim strHyper as string
currentdb.openrecordset("Select filename from yourtable")
if rs.EOF then exit sub
rs.movefirst
strHyper = "//myserver/mydirectory/" & rs!filename & ".pdf"
followhyperlink strHyper

another option is to build a similar string from a form...with your table as
it's recordsource.
create an unbound textbox that builds the string
then on the click event of the textbox
use the FollowHyperlink command to launch your PDF.

J
I have a table with a file name field (for a pdf file), but the file name is
only the name of the field-- it doesn't include the network path of where the
[quoted text clipped - 9 lines]
 
K

KFox via AccessMonster.com

J--
I'm struggling with this part of the code:

currentdb.openrecordset("Select filename from yourtable")

The name of the field on my form is "CertHolder". And the name of my table
is "tblIssued". Do I use these fields somewhere between the parenthesis
above? I'm unclear of the proper syntax.

TIA!
Kellie
Dim rs as DAO.Recordset
Dim strHyper as string
currentdb.openrecordset("Select filename from yourtable")
if rs.EOF then exit sub
rs.movefirst
strHyper = "//myserver/mydirectory/" & rs!filename & ".pdf"
followhyperlink strHyper

another option is to build a similar string from a form...with your table as
it's recordsource.
create an unbound textbox that builds the string
then on the click event of the textbox
use the FollowHyperlink command to launch your PDF.

J
I have a table with a file name field (for a pdf file), but the file name is
only the name of the field-- it doesn't include the network path of where the
[quoted text clipped - 9 lines]
 
K

KFox via AccessMonster.com

Never mind-- I figured it out.

Thanks again!!
J--
I'm struggling with this part of the code:

currentdb.openrecordset("Select filename from yourtable")

The name of the field on my form is "CertHolder". And the name of my table
is "tblIssued". Do I use these fields somewhere between the parenthesis
above? I'm unclear of the proper syntax.

TIA!
Kellie
Dim rs as DAO.Recordset
Dim strHyper as string
[quoted text clipped - 17 lines]
 

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