Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Create a hyperlink in Microsoft Access Databebase table.

Posted on 2014-12-09
7
Medium Priority
?
620 Views
Last Modified: 2014-12-11
I have created a table that has a hyperlink field in it.  I have created a query that creates a string of data that represents the hyperlink.  I am able to update this information into the table.  The hyperlink is blue but when I edit the hyperlink it has not created and address for the hyperlink.  How can I accomplish this.  

Thanks so much.
0
Comment
Question by:fasse
7 Comments
 
LVL 49

Accepted Solution

by:
Dale Fye earned 1600 total points
ID: 40490093
I generally avoid hyperlink data fields in favor of text fields.  Then I use either the double click event of the field, or a command button beside the field to actually follow the hyperlink using the  Application.FollowHyperlink method.

One of several problems with the hyperlink datatype is that it is hard to query and edit.
0
 

Author Comment

by:fasse
ID: 40490102
I will think more about that.  I am travelling today so I will try it tonight and see what I think.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40490213
I am with @Dale Fye on this.
Only Access can deal with the hyperlink field, so the minute you look to do something with the backend other than Access, you have to take the hyperlink field apart back to it's constituent parts, which are basically
<A href="http://www.someplace.com">here</a> transformed into
here#http://www.someplace.com#

Now, you don't want the end-users in the tables anyway -- so what's the point of the hyperlink there?
Not much!
Now, since you need both the anchor and the address in separate fields, it's not much hassle to throw the 'here' into a visible textbox, the 'http://www.someplace.com' into a hidden textbox and have a command button that  does
Application.FollowHyperlink Me.HiddenControl.Value

It will be more robust over the long-term as @Dale Fye has alluded to.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:fasse
ID: 40490592
That makes sense so even if a I have multiple hyperlinks, when I click on the hyperlink I code that uses that  variable to change the hidden field then open the file.
0
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 200 total points
ID: 40490967
I agree with Dale and Nick - don't use Hyperlink data types. They are yet another bad design idea intended to make Access more "Excel-like".

As the others have said, use Application.FollowHyperlink to do this. FollowHyperlink depends on the file extension, and the Windows File Association data, to determine what to do with the file. So if you have this in the field:

C:\SomeFolder\SomeDocument.doc

And you have Microsoft Word associated with the "doc" extension, then Access will attempt to open that file using the current version of Word.
1
 
LVL 26

Assisted Solution

by:Nick67
Nick67 earned 200 total points
ID: 40491838
That makes sense so even if a I have multiple hyperlinks, when I click on the hyperlink I code that uses that  variable to change the hidden field then open the file.

There are many ways to do it.  You can have textboxes on continuous forms with command buttons.
You can have a combobox that binds the anchor and link fields, with the width of the link field being zero, and then have the AfterUpdate event pull that .Columns(x) value and do the link.
Ditto for a listbox.

If you look at Application.FollowHyperlink you will see that for filesystem links like Word documents, you can have the document opened to specific bookmarks.  Lots of ways to do it.
0
 

Author Closing Comment

by:fasse
ID: 40494052
Thanks guys it works great.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question