Hyperlink addresses

A

Allen Yap

I link a file using a command button.

Me.LinkTo1.SetFocus
DoCmd.RunCommand acCmdInsertHyperlink

However sometimes the address appear as either

C:\BizDemo\Presentation\Slide2.BMP or

.../../../BizDemo/Presentation/Slide2.BMP

I prefer the 1st as the 2nd produces the message "Hyperlink can be
harmful..."

Any help would be appreciated.

Thanks
 
S

storrboy

I've never actually tried the method you are using, but I wonder if
setting warnings to false would help.

Me.LinkTo1.SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdInsertHyperlink
DoCmd.SetWarnings True
 
A

Allen Browne

Add the "file:///" prefix to the Address part of the hyperlink, e.g.:

file:///C:/BizDemo/Presentation/Slide2.BMP
 
A

Allen Yap

Thanks for this quick response,

The SetWarning True/False has no effect on the warning message unless I shut
it from the registry.

I am very interested to solve this: (below)

I link a file using a command button.

Me.LinkTo1.SetFocus
DoCmd.RunCommand acCmdInsertHyperlink

However sometimes the address appear as either

C:\BizDemo\Presentation\Slide2.BMP or

.../../../BizDemo/Presentation/Slide2.BMP
 
A

Allen Yap

But how do I include it into my command button so that it will show as per
your example.

Thanks
 
A

Allen Browne

I'm not clear what your source is: perhaps a text box bound to a Text field?
Or perhaps a Hyperlink field? Or an unbound text box?

If it's a Text field (or unbound), it might be something like this:

With Me.Text99
If Not IsNull(.Value) Then
FollowHyperlink .Value & "#" & "file:///" & Replace(.Value, "\",
"/") & "#"
End If
End With
 
A

Allen Yap

So sorry for not being clear.

1) LinkTo1 is the name of a text box with its control source - a hyperlink
field in a table
2) I use a command button with (below code) to assign an address to LinkTo1

Me.LinkTo1.SetFocus
DoCmd.RunCommand acCmdInsertHyperlink

3) It is very strange that when I select file from my Drive C:\ the address
appears as
C:\BizDemo\Presentation\Slide2.BMP

4) When I select file from my Drive D:\ the address appears as

../../../BizDemo/Presentation/Slide2.BMP

I prefer it to appear as D:\BizDemo\Presentation\Slide2.BMP


5) I get a Hyperlink Harmful Warning with the prefix ../../../ but not C:\

Thanks for you help.

AY
 
A

Allen Browne

If you are using a hyperlink field, you need to get the file:/// prefix into
the address. Right-click the field to edit the address, and add the prefix
in the dialog.
 
A

Allen Yap

I can type-in the address and it will appear exactly as I wanted it.
But when I use the Lookin DropDown box I get

.../../../BizDemo/Presentation/Slide2.BMP

when it should be

D:\BizDemo\Presentation\Slide2.BMP

This does not happen when I use the same method to select file in Drive C:\

Regards


AY
 
A

Allen Browne

Is there a check box for relative/absolute address in your version of
Access, when using that dialog?
 
A

Allen Yap

I am not too sure about the check box. How do I check this out? I am using
Access 2003.

Thanks
 
A

Allen Browne

There doesn't seem to be the relative/absoute option in the dialog in A2003.

You could do it programmatically, using HyperlinkPart() to parse the
address, adding the prefix and full path, re-composing the whole address,
and writing it back.
 
A

Allen Yap

Thanks, but how do I do that, I am an amature! If only I could send you the
DB, you can see it for yourself.

Regards
 
A

Allen Browne

Might have to let you work on this for yourself.

Please understand that we are volunteers, and if we took on everyone's work,
we could get no paid work done at all.

Hopefully you at least know what the issues are now, so you can find the
path forward as your understanding of Access grows.
 
A

Allen Yap

Thanks, I understand.

Regards

AY

Allen Browne said:
Might have to let you work on this for yourself.

Please understand that we are volunteers, and if we took on everyone's work,
we could get no paid work done at all.

Hopefully you at least know what the issues are now, so you can find the
path forward as your understanding of Access grows.
 

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