By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,495 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,495 IT Pros & Developers. It's quick & easy.

need to trap hyperlink error message

P: n/a
Hi All,

Sorry but I have to create new message since it cannot find the old
message to send a reply. Coming back to this hyperlink thing I will
try to explain the real problem cause I think we are going in circles.

I have a continous form with a hyperlink field on it. Normally when
you click on a hyperlink field Access will follow the Hyperlinkbase
set in the database.
This is for example in my case "I:\". However I have two different
hyperlink fields in my database. One of them has documents in "I\In"
and the other in "I\Out". So I thought lets add the direction to the
proper folder in the code (see below). That does work by the way. The
only problem is that Access, after opening the word.doc, comes up with
a error message that it could not find the document. That logic
because it is looking in "I\". But I already worked around that by
building this code.

The big Q is how do I get rit of this error message?
Private Sub HYPERLINK_Click()

Dim str As String

If Not IsNull(Me.HYPERLINK) Then
str = Me.HYPERLINK
Application.FollowHyperlink "In\" & str
End If

End Sub

Regards,

Marco
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Marco Krechting wrote:
Hi All,

Sorry but I have to create new message since it cannot find the old
message to send a reply.
You can always use Google Groups. Set the search to Advanced. Enter
*Access* in the groups. Enter either your name or your e-mail address
in the From part.

Most newsreaders allow you to do a search. If you can't do that, you
may never find this response let alone your initial message.

Coming back to this hyperlink thing I will try to explain the real problem cause I think we are going in circles.

I have a continous form with a hyperlink field on it. Normally when
you click on a hyperlink field Access will follow the Hyperlinkbase
set in the database.
This is for example in my case "I:\". However I have two different
hyperlink fields in my database. One of them has documents in "I\In"
and the other in "I\Out". So I thought lets add the direction to the
proper folder in the code (see below). That does work by the way. The
only problem is that Access, after opening the word.doc, comes up with
a error message that it could not find the document. That logic
because it is looking in "I\". But I already worked around that by
building this code.

The big Q is how do I get rit of this error message?
Private Sub HYPERLINK_Click()

Dim str As String

If Not IsNull(Me.HYPERLINK) Then
str = Me.HYPERLINK
Application.FollowHyperlink "In\" & str
End If

End Sub

Regards,

Marco


Well, I asked if you would do a Debug.Print on "In\" & str so you could
see the result.

At least you provided some more info this time. So you set the path to
"I\". Having worked for a few years on computers, I guess you aren't
working on Windows. Are you working on Linux, Unix, or some proprietary
operating system? Usually one would expect "I:\" where the colon
separates the drive from the folder.

Let's assume the file name is called Test.Doc. In your code you
concantenate "IN\" with "I\Test.Doc". The net result is "IN\I\Test.Doc".

Again, this must be a proprietary operating system. It does not follow
normal Windows/Dos file name specifications. Nor does it follow
relative addressing name structures.

I would perhaps read how a filename path is created in some help files
or get onto google and read some directions on creating relative path
and file names, or perhaps create another message and ask how to create
a filename path and how to create a relative addressing path. Once you
have that concept nailed down you should be able to open the file.
Until then, you'll continue spinning in circles.

Also, you should learn how to do a Debug.Print and know where to look to
view the results. Check help for info on Debug. Look in your menu bars
for Immediate Window when you have a code module open once you know how
and when to use Debug.Print.
Nov 13 '05 #2

P: n/a
I'm working with Win XP, the drive letter "I" could be anything. Lets called
it C:\
The file Test.doc should be in the folder I:\In\test.doc.
The debug.print resulted in: I:\In\whatever.doc#whatever.doc# etc.....

BUt still my Q is how to lose the damn error message.

Marco

"Salad" <oi*@vinegar.com> wrote in message
news:VP*****************@newsread3.news.pas.earthl ink.net...
Marco Krechting wrote:
Hi All,

Sorry but I have to create new message since it cannot find the old
message to send a reply.


You can always use Google Groups. Set the search to Advanced. Enter
*Access* in the groups. Enter either your name or your e-mail address in
the From part.

Most newsreaders allow you to do a search. If you can't do that, you may
never find this response let alone your initial message.

Coming back to this hyperlink thing I will
try to explain the real problem cause I think we are going in circles.

I have a continous form with a hyperlink field on it. Normally when
you click on a hyperlink field Access will follow the Hyperlinkbase
set in the database.
This is for example in my case "I:\". However I have two different
hyperlink fields in my database. One of them has documents in "I\In"
and the other in "I\Out". So I thought lets add the direction to the
proper folder in the code (see below). That does work by the way. The
only problem is that Access, after opening the word.doc, comes up with
a error message that it could not find the document. That logic
because it is looking in "I\". But I already worked around that by
building this code.

The big Q is how do I get rit of this error message?
Private Sub HYPERLINK_Click()

Dim str As String

If Not IsNull(Me.HYPERLINK) Then
str = Me.HYPERLINK
Application.FollowHyperlink "In\" & str
End If

End Sub

Regards,

Marco


Well, I asked if you would do a Debug.Print on "In\" & str so you could
see the result.

At least you provided some more info this time. So you set the path to
"I\". Having worked for a few years on computers, I guess you aren't
working on Windows. Are you working on Linux, Unix, or some proprietary
operating system? Usually one would expect "I:\" where the colon
separates the drive from the folder.

Let's assume the file name is called Test.Doc. In your code you
concantenate "IN\" with "I\Test.Doc". The net result is "IN\I\Test.Doc".

Again, this must be a proprietary operating system. It does not follow
normal Windows/Dos file name specifications. Nor does it follow relative
addressing name structures.

I would perhaps read how a filename path is created in some help files or
get onto google and read some directions on creating relative path and
file names, or perhaps create another message and ask how to create a
filename path and how to create a relative addressing path. Once you have
that concept nailed down you should be able to open the file. Until then,
you'll continue spinning in circles.

Also, you should learn how to do a Debug.Print and know where to look to
view the results. Check help for info on Debug. Look in your menu bars
for Immediate Window when you have a code module open once you know how
and when to use Debug.Print.

Nov 13 '05 #3

P: n/a
Marco Krechting wrote:
I'm working with Win XP, the drive letter "I" could be anything. Lets called
it C:\
The file Test.doc should be in the folder I:\In\test.doc.
The debug.print resulted in: I:\In\whatever.doc#whatever.doc# etc.....
Good luck. A filename like I:\In\whatever.doc#whatever.doc# is quite
unique. It appears to be concatentating both the file name and the
display name. Someday try to use Hyperlink(). Here is an example of it.

h = "Test.Doc#C:\Test\Test.Doc" 'creates a hyperlink
? hyperlinkpart(h,acDisplayedValue)
Test.Doc
? hyperlinkpart(h,acDisplayText)
Test.Doc
? hyperlinkpart(h,acAddress)
C:\Test\Test.Doc

You might want to search google in advanced groups for threads on
hyperlinks. I believe you don't fully understand the components that
make up a hyperlink in Access and you won't succeed until you do.
BUt still my Q is how to lose the damn error message.
Pass the your FollowHyperlink a valid filename. I don't see how you can
avoid errors when you pass invalid filenames. The phrase "Garbage in,
garbage out" comes to mind.

Marco

Nov 13 '05 #4

P: n/a
Marco Krechting wrote:
I'm working with Win XP, the drive letter "I" could be anything. Lets called
it C:\
The file Test.doc should be in the folder I:\In\test.doc.
The debug.print resulted in: I:\In\whatever.doc#whatever.doc# etc.....

BUt still my Q is how to lose the damn error message.

Marco


Below came from another thread. Check out Allen's link.

The HyperlinkPart() function is useful for parsing the parts of the
hyperlink. More info on how hyperlinks work in:
Introduction to Hyperlink fields
at:
http://members.iinet.net.au/~allenbrowne/casu-09.html
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.