Relative link to folders and files on disk

  • Thread starter Thread starter Brian Wilder
  • Start date Start date
B

Brian Wilder

It may be dumb of me, but I do not see how to create a "relative" link to a
file on disk. I see how to create an absolute link, say,
C:\foldertree\folder\filename.doc
but, somehow, I don't see how to make that link relative,
or to use a variable for C:\, if that's an alternative.

I want to include as data, hyperlinks to files in a certain folder tree on
disk. Which disk that folder tree will be on, may vary from PC to PC, so I
would like the link to be relative, so that I can put the folder tree on D:
on some PCs and C: on others, or maybe some arbitrary network drive.

Thank you for any advice, insight or pointer to resources.
 
Brian Wilder said:
It may be dumb of me, but I do not see how to create a "relative"
link to a file on disk. I see how to create an absolute link, say,
C:\foldertree\folder\filename.doc
but, somehow, I don't see how to make that link relative,
or to use a variable for C:\, if that's an alternative.

I want to include as data, hyperlinks to files in a certain folder
tree on disk. Which disk that folder tree will be on, may vary from
PC to PC, so I would like the link to be relative, so that I can put
the folder tree on D: on some PCs and C: on others, or maybe some
arbitrary network drive.

Thank you for any advice, insight or pointer to resources.

One option is to set the database's HyperlinkBase property. The help
file topic "Set a hyperlink base for an Access file" tells how to do it
manually in the Database Properties dialog, but you can probably do it
with code at run time (I think I tried this once, but I can't remember
how it came out). My guess is that you have to create the propery if it
hasn't been previously set. This would be one of the properties in
CurrentDb.Containers("Databases").Documents("SummaryInfo").Properties.

Another option would be not to use hyperlink fields (which I find
cumbersome anyway), but to use text fields instead. Then when you want
to follow one of these pseudo-hyperlinks, you assemble the complete path
from the data and use Application.FollowHyperlink to follow it. This
would be my choice.
 
Back
Top