Listbox with Hyperlink (1 Viewer)

JPR

Registered User.
Local time
Yesterday, 23:45
Joined
Jan 23, 2009
Messages
192
Hello,

I was wandering if you could help me out with this. I have created a table with two fields:

Title (records list name of mostly used web/intranet pages)
Web Pages (hyperlinks of the web/intranet pages in field Title)

The data type of the web pages field is set to hyperlink and I am able to open the appropriate web page from the table.

I would now like to add this info to a list box which will only display the Title.
I was wandering if there is a way that would allow me to click on selected records of the list box and open the appropriate hyperlink.
Thank you
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:45
Joined
May 7, 2009
Messages
19,169
you may use Dbl-Click. a single click is the entry on the listbox.
create two column listbox, the title and web page column.
show only the title by setting the column width to 1;0 and the column count to 2.

add code to dbl-click event of the listbox:

Private Sub List0_DblClick(Cancel As Integer)
Application.FollowHyperlink List0.Column(1)
End Sub
 

JPR

Registered User.
Local time
Yesterday, 23:45
Joined
Jan 23, 2009
Messages
192
Thank you Arnel,
I am getting an error (7971) and have noticed that after a security warning that advises about hyperlink from trusted sources, at the beginning and end of the hyperlink I get an #.
Obviously this # are not in the hyperlink. Another think I did not indicate before, is that the list box is used to display several utilities in my program (simple tips for users) and amongst these, there is this web page/Intranet. Thank you
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:45
Joined
May 7, 2009
Messages
19,169
you extract the second text from your hyperlink field:

Application.FollowHyperlink Split(Lists0.Column(1), "#")(1)
 

JPR

Registered User.
Local time
Yesterday, 23:45
Joined
Jan 23, 2009
Messages
192
Wow thank you Arnel. It's years I search the web for help on MS Access and have to admit that your replies are fast, easy and have always a solution. Thank you
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:45
Joined
May 7, 2009
Messages
19,169
you're welcome.
 

moke123

AWF VIP
Local time
Today, 02:45
Joined
Jan 11, 2013
Messages
3,852
You may want to consider storing your link as plain text since you are already storing the title and the link.
With hyperlink datatype the pound sign (#) seperates the title from the link. Using followhyperlink will still work with plain text.

Another option is to use Shellexecute instead of followhyperlink. This has the functionality to open any path, be it a webpage or a file.
see this link http://access.mvps.org/access/api/api0018.htm
 

Dreamweaver

Well-known member
Local time
Today, 06:45
Joined
Nov 28, 2005
Messages
2,466
I'm with moke123 Colin posted a updated shellexecute that is 32 and 64 bit compatable
I never store hyperlinks.
 

Isaac

Lifelong Learner
Local time
Yesterday, 23:45
Joined
Mar 14, 2017
Messages
8,738
You may want to consider storing your link as plain text since you are already storing the title and the link
I agree also, hyperlinks are just trouble might as well store plain text and code things to open as needed.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:45
Joined
Oct 29, 2018
Messages
21,358
Hi. Well, if we are all offering opinions, here's mine. Cheers!
 

Users who are viewing this thread

Top Bottom