Hyperlink Issue (1 Viewer)

105tt

New member
Local time
Today, 11:09
Joined
Feb 4, 2022
Messages
11
I have a database that has a table set up with a hyperlink field. Some hyperlinks will not launch correctly even though the address is correct. If you copy and paste the address to a browser, it works just fine. It won't work, however, when clicking the link through a user form in Access.

I've done some research and it seems a text field to house the hyperlink is a better option, so I created a test database with the hyperlink field set up as text instead of hyperlink. Then through changing some properties on the form, it makes it appear as though it's a link to the user. I then set up a OnClick code to to trigger the launch on click using Application.FollowHyperlink WOLink, , True

I now get the following error when clicking on the text formatted link, which actually is quite similar to the original error through the hyperlink formatted link. Anyone have any ideas how to get the hyperlink to work as a text??? thanks!!

1648260098716.png
 

June7

AWF VIP
Local time
Today, 10:09
Joined
Mar 9, 2014
Messages
5,423
Would need to see those hyperlinks.

Review http://allenbrowne.com/func-GoHyperlink.html

Or try Shell command:
Code:
Private Sub btnLink_Click()
On Error GoTo ErrProc
'FollowHyperlink is not working properly
''Application.FollowHyperlink Me.tbxLink
Dim wsShell As Object
Set wsShell = CreateObject("WScript.Shell")
wsShell.Run Chr(34) & Me.tbxLink & Chr(34)
Me.Title.SetFocus
ExitProc:
Set wsShell = Nothing
Exit Sub
ErrProc:
MsgBox "Cannot open document. Contact database administrator. : " & Err.Number
End Sub
 

moke123

AWF VIP
Local time
Today, 14:09
Joined
Jan 11, 2013
Messages
3,852
Hyperlink datatype consists of 4 parts seperated by an octothorpe (#)
Make sure that you didn't retain any of the parts other than the url portion when you converted to text.
 

June7

AWF VIP
Local time
Today, 10:09
Joined
Mar 9, 2014
Messages
5,423
When did that 4th part get added? As of Access 2010, Hyperlink type field creates link with 3 parts.

And is the # at end really correct?
 

moke123

AWF VIP
Local time
Today, 14:09
Joined
Jan 11, 2013
Messages
3,852
When did that 4th part get added? As of Access 2010, Hyperlink type field creates link with 3 parts.

And is the # at end really correct?
Not sure when added. All I know is I tried them once many years ago and decided I didn't like them and haven't used them since. Much easier to work with a field for display name and another for the path. I've always used Dev Ashish's routine to launch things. http://access.mvps.org/access/api/api0018.htm
 

105tt

New member
Local time
Today, 11:09
Joined
Feb 4, 2022
Messages
11
On Error GoTo ErrProc 'FollowHyperlink is not working properly ''Application.FollowHyperlink Me.tbxLink Dim wsShell As Object Set wsShell = CreateObject("WScript.Shell") wsShell.Run Chr(34) & Me.tbxLink & Chr(34) Me.Title.SetFocus ExitProc: Set wsShell = Nothing Exit Sub ErrProc: MsgBox "Cannot open document. Contact database administrator. : " & Err.Number

This worked perfectly! thank you!!!
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:09
Joined
Feb 19, 2002
Messages
42,971
clicking the link through a user form in Access.
Just FYI "user form" has a meaning in Office but Access does NOT use "user forms". Access uses "Access forms" or just "forms". If you search for information on "user form", it will not be applicable to a form built with Access.
 

sonic8

AWF VIP
Local time
Today, 19:09
Joined
Oct 27, 2015
Messages
998
When did that 4th part get added? As of Access 2010, Hyperlink type field creates link with 3 parts
Very recently. ;-) It must have been with Access 97 or 2000.
In the "Insert Hyperlink" dialog there is a button "Screen Tip" in the upper right corner. Click that and you'll get the fourth part of the Hyperlink. There is also a hint included, that this is only supported with very modern web browsers, such as Internet Explorer 4 and newer. ;-)

My take on the Hyperlink data type with some code examples on how to get rid of them, can be found here: Issues with the Hyperlink data type in Microsoft Access
 

sonic8

AWF VIP
Local time
Today, 19:09
Joined
Oct 27, 2015
Messages
998
Just FYI "user form" has a meaning in Office but Access does NOT use "user forms".
Access supports User Forms all the same as any other VBA enabled application. Whether they are used or not is up to the developer. Nonetheless, I agree that it is very unusual to use User Forms in an Access application. The only real-world case where I encountered User Forms in Access was when someone deliberately used one to create a form wider than the width limit of an Access Form.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:09
Joined
Feb 19, 2002
Messages
42,971
I meant that Access does not use user form natively. If you are searching for help, it is important to use the correct terminology.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:09
Joined
Oct 29, 2018
Messages
21,358
Access supports User Forms all the same as any other VBA enabled application. Whether they are used or not is up to the developer. Nonetheless, I agree that it is very unusual to use User Forms in an Access application. The only real-world case where I encountered User Forms in Access was when someone deliberately used one to create a form wider than the width limit of an Access Form.
I think the first time I heard a UserForm was used in Access was when I looked at the VBA TreeView demo.
 

June7

AWF VIP
Local time
Today, 10:09
Joined
Mar 9, 2014
Messages
5,423
Very recently. ;-) It must have been with Access 97 or 2000.
In the "Insert Hyperlink" dialog there is a button "Screen Tip" in the upper right corner. Click that and you'll get the fourth part of the Hyperlink. There is also a hint included, that this is only supported with very modern web browsers, such as Internet Explorer 4 and newer. ;-)

My take on the Hyperlink data type with some code examples on how to get rid of them, can be found here: Issues with the Hyperlink data type in Microsoft Access
Well, dang, never explored that button and Allen Browne doesn't mention 4th part http://allenbrowne.com/casu-09.html.
So just tested. There is no additional # at end.
 

Users who are viewing this thread

Top Bottom