Question Hyperlink code problem

bradford8481

Registered User.
Local time
Today, 05:15
Joined
Dec 13, 2009
Messages
11
I am trying to set up an image, on a form, to have a hyperlink triggered on the OnClick property of the image.

I have searched for a similar problem with no luck as yet.
Here is the code...

FollowHyperlink "http://www.google.com", , True

And I get this error...

"Cannot locate the internet server or proxy server"

I am on the internet and able to surf just fine. I've cleared my browser history and cookies. Still no good,

What have I missed here?
Any help will be appreciated
 
for future reference, if you have a specific error message that you want to research, type in "ms access" and then the exact error message given by access in the google search box. I did this for you, and here's the top hit that came up:

http://support.microsoft.com/kb/218153
 
OK, I tried the registry edits with no luck.
Does anyone use some other code to open a web page from your applications other then...

FollowHyperlink "http://www.google.com", , True

I have tried this on several PC's. All have failed to go to the site. I thought it was just my laptop.

If you think of anything, let me know.
Thanks,
Bob
 
Your code worked fine for me (Internet Explorer 8 and MS Access 2007)

Here's something else to try. It opens the default web browser and includes a check to ensure that the web address is in a valid format:

Code:
Option Compare Database
Option Explicit
 
Private Const SW_SHOW As Long = 5
 
Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" ( _
    ByVal hWnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
 
Private Sub ImageName_Click()
 
Dim strAddress As String
Dim rc As Long
Dim strFile As String
 
strAddress = "google.com"
 
If (Left(strAddress, 7) <> "http://" And Left(strAddress, 8) <> "https://") Then
    strFile = "http://" & strAddress
 
Else
    strFile = strAddress
 
End If
 
rc = ShellExecute(0, "open", strFile, "", "", SW_SHOW)
 
End Sub

HTH.
 
Last edited:
Pyro
That did it. I added the ShellExecute code and it works like a charm.
Thank you for your help on this. It has been taking me in circles for a while now.

Have a great day
Bob
 

Users who are viewing this thread

Back
Top Bottom