FollowHyperlink "unspecified error"

D

David W. Fenton

Today at a client's, I encountered an odd problem with
Application.FollowHyperlink (Access 2002 running on Win2K). The app
updates a website via the MSXHTML object, then uses FollowHyperlink
to open a page on the website that displays the results. I'm passing
only the URL argument.

The update with MSXHTML is working just fine, but today
FollowHyperlink was unreliable and eventually quit working entirely.
I first did several updates and it worked, but then one failed with
"unspecified error" (I can't recall the exact error number). So I
closed and restarted Access, and one update worked and the rest
failed. So I rebooted the machine and started up Access and it
failed on the first try.

Anyone have any ideas on this? It seems like something has gone
wrong with the mechanisms that FollowHyperlink uses as the error is
clearly coming from outside Access (there is no error number for it,
in the default error message that comes up if I turn off error
handling), but I don't know where those are in the OS. The user
reports that this first started happening in the last couple of
weeks, but she doesn't often use this functionality (that was the
goal today, to get her to start using it, since she paid for having
it programmed into the app nearly two years ago), so it could be a
longer-standing issue.

I find one reference in Google Groups that doesn't seem to apply,
and nothing anywhere else.

I'm tempted to convert it to ShellExecute, but wonder if
FollowHyperlink is just a wrapper around that.

Suggestions?
 
D

Daniel Pineault

When you say you are passing the url, are you passing the www. or the http:// ?

Also you might want to try the following bit of code that I came across a
while back.

'Original Source: http://www.pacificdb.com.au/MVP/Code/ExeFile.htm
Public Const SW_HIDE = 0
Public Const SW_MINIMIZE = 6
Public Const SW_RESTORE = 9
Public Const SW_SHOW = 5
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMINNOACTIVE = 7
Public Const SW_SHOWNA = 8
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOWNORMAL = 1

Public 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

Public Sub ExecuteFile(sFileName As String, sAction As String)
Dim vReturn As Long
'sAction can be either "Open" or "Print".

If ShellExecute(Access.hWndAccessApp, sAction, sFileName, vbNullString,
"", SW_SHOWNORMAL) < 33 Then
DoCmd.Beep
MsgBox "File not found."
End If
End Sub

You would use it like:

ExecuteFile("http://www.YourURL.com","open")
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
D

David W. Fenton

=?Utf-8?B?RGFuaWVsIFBpbmVhdWx0?=
When you say you are passing the url, are you passing the www. or
the http:// ?

Er, what? I'm passing a URL, something like:

https://website.com/index.php?InventoryID=1234&Time=9285702891735

(where I'm inventing the arguments)

This has been working for two years.
Also you might want to try the following bit of code that I came
across a while back.

I already said I was going to try replacing FollowHyperlink with the
API ShellExecute, so your code doesn't offer anything I haven't
already planned to do. My fear is that it will break in exactly the
same way, since I can't imagine that FollowHyperlink is anything
more than a wrapper for the ShellExecute API, but maybe a direct
implementation would avoid some kind of problem in the wrapper
function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top