Open a hyperlink from a Combo box

109bow

Registered User.
Local time
Today, 23:37
Joined
Oct 24, 2007
Messages
141
Hi all,
I have a database in which I require the users to be able to access risk assessments on the company's server. To do this I have a form risk_assessments, with a combo box. This combo box needs to list the refno and risktype, but not show the actual hyperlink.
I have attached a db, with some random data and pages.
from the web I have found that something along the lines of;
Application.FollowHyperlink Combo2.Value is required, but I can't get it to work.
The hyperlinks do work when accessed from the table, so would suggest my combo box is set up incorrectly.
Any suggestions very welcome. Thanks
 

Attachments

Try
Code:
Application.FollowHyperlink Me.Combo2.Column(3)

Edit: Does not work for the google url only though?
 
Gasman, thanks for your reply.
I have added third entry in the table for a file located on my PC. the combo box is unable to open this one, could you please enlighten me.
Many thanks
 

Attachments

I'm also an amateur here, but that link does not open from the table either, but that is because I do not have that path, but even one of mine does not work.

Most likely due to the spaces in the file name.
I think you need the %20% to take the place of spaces.? and the folder delimiter should be / I believe?

You might also have to open files like excel with the native app, and only open urls with the hyperlink?

Hopefully someone more knowledgeable will jump in?

There is code on this site to open any local file with the registered app for that device. have a search.

HTH
 
Last edited:
OK, the spaces are a red herring as 'C:\temp\Test Folder\Yahoo.csv' works fine as does 'C:\temp\Test Folder\BH dates.xls'

Are you sure the file exists?, does it open from the table as the others did?

Edit: And the google url works on my home PC ?:banghead:
 

Attachments

Last edited:
Gasman, thanks again for your input.
I have just double checked the last record in the table, it does open as expected from that table.
The Google record now opens as I have added the http:/ etc.
I will search this site as you suggest for other options. As a last resort I will create a number of buttons on the form so each opens a different risk assessment.
Thanks
 
As requested, I've attached code that will open any file: fHandleFile
This was written many years ago by Dev Ashish http://access.mvps.org/access/api/api0018.htm

It works on local files using the default application & also opens web pages using the default browser

Updated version of your db attached with new module containing the fHandleFile function

TESTED using your form with both web links and various files from my PC

NOTE:
For this to work using your form, I had to change the datatype of your risklink field from hyperlink to text.
This means the links can no longer be clicked from the table
 

Attachments

Last edited:
ridders, you are a genius. This is exactly what I need.
Many many thanks
 
Application.FollowHyperlink Split(Me.Combo2.Column(3), "#")(1)
 

Users who are viewing this thread

Back
Top Bottom