Building Hyperlinks In VBA modules - BCP

G

Guest

I am attempting to load Hyperlinks into a table using a VBA module. To do
this I first collect the file names in a specified Directory by writing the
output of the DOS DIR command to a file. I then read through the file and
write the fully qualified path and full file name to a field defined as
Hyperlink. This works great except for one minor issue. While the location
and name are in the field the field doesn't link to the document. Being able
to Hyperlink to the document is a pretty important aspect of a Hyperlink and
one I need to resolve.
 
G

Guest

Hi,

When adding hyperlinks via VBA, it is important to be aware that hyperlinks
consist of 4 different parts. Each part is separated by a # sign. Access
does not display all parts. The first part is the display name, then a #
sign, then the actual hyperlink address, then another # sign, etc.

If a display name is entered, that's what is displayed to the user. If not,
the address is displayed. In either case, the address determines the actual
link.

In your case, if you did not add a # sign in front of the path/filename, it
would have entered the path/filename as the display name, without any address.

Try adding a # sign before and after the path/filename, and it will probably
work for you.

Access has a full description of the parts under "About Hyperlinks" in Help.
You may also want to look at the hyperlinkpart() function (I'm pretty sure
that is the name of it). That function can be used in queries to pull just
one part of a hyperlink field. It can be useful sometimes.

One other option you may want to consider. You can just enter the address
in a regular text field (without the # signs), and use DoCmd.FollowHyperlink
in VBA to open the file when clicked.

HTH, Ted Allen
 

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