PDA

View Full Version : Link Help



naberz09
10-24-2008, 05:19 AM
I'm working in Access 2007.

I have a database that has several links to web pages located on my computer. The links are supposed to open the web page and go to a specific part of the web page when clicked. The path name uses the # character to do this, but for some reason this doesn't work when the data type for the field is hyperlink. Another person suggested that i change the data type to text and use a event procedure in a form to navigate to the hyperlink. Any help on how I can do this?

CreganTur
10-24-2008, 05:38 AM
Welcome to the forum! It's always good to see new members.

You're correct that Hyperlinks use the pound sign "#", but it must be used in a specific way. Hyperlinks can have up to 4 different parts, but the first two are the most important. The first part is the display text- what you want people to see when they look at the hyperlink. The second part is the actual address for the link to follow when it is clicked. These parts are separated by a "#".

When entering data into a table field that is set to Hyperlink data type if you write in just http://www.vbaexpress.com and then navigate to a different field, Access will automatically adjust the field so that the name and address look the same- if you could see the actual data you would see:
htt://www.vbaexpress.com#http://www.vbaexpress.com
If you want to display the name VBAX, then you would input:
VBAX#http://www.vbaexpress.com
I'm explaining all of this because if you input the data incorrectly it can cause problems where clicking on the hyperlink does nothing. If you are pushing data into the hyperlink field sometimes you have to explicitly push the data with the "#" to get it to work correctly.

If you want to change the data type to text, then you can use the VBA FollowHyperlink method. It would look like:
Application.FollowHyperlink "http:\\www.vbaexpress.com", , True
The True means that a new window will be opened.

HTH:thumb