Hyperlink problem (setvalue) (1 Viewer)

stpiepgr

Member
Local time
Today, 03:55
Joined
Nov 6, 2002
Messages
25
I have been struggling with this for a while. On my form I have a text field that upon change sets (setvalue) the hyperlink for a file which worked great (or so I thought) but I couldn't figure out why the links weren't operating correctly. A search of this site revealed the error of my ways......that using 'setvalue' will not work for hyperlinks.

My problem is that I can't get the code from BillR to work correctly. The code uses a command button but I need to do it with the text box (I think). My hyperlink field is [MapLoc] and the text box is [txtDestin]. The code I am trying to work out is:

Dim ctl As CommandButton, i As Integer
Set ctl = Me!Command44
With ctl
If IsNull(Me!Text56) = False Then
.HyperlinkAddress = Me!Text56
End If
If .HyperlinkAddress = "" Then
GoTo out
End If
.Hyperlink.Follow True
End With
out:
End Sub

Thanks!
 

stpiepgr

Member
Local time
Today, 03:55
Joined
Nov 6, 2002
Messages
25
Still no go!

I have been working on this some more and digging through the VB help but can't figure out what I am doing wrong with the code. I get a VB Error message saying "Run-time error '438' Object doesn't support this property or method"

The code i am using is:

Private Sub txtNextLoc_Change()
Dim txt As TextBox, i As String
Set txt = Me!txtDestination
With txt
If IsNull(Me!txtDestination) = False Then
Me!MapLoc.HyperlinkAddress = Me!txtDestination
End If
If Me!MapLoc.HyperlinkAddress = "" Then
GoTo out
End If
Me!MapLoc.Hyperlink.Follow True
End With
out:
End Sub

Any suggestion??? Thanks
Steve
 

Len Boorman

Back in gainfull employme
Local time
Today, 03:55
Joined
Mar 23, 2000
Messages
1,930
I had a great deal of trouble generating hyperlinks via code but did solve the problem.

I did find in the help somewhere that you need to wrap the link in #'s

So in the code you are using to generate the hyperlink you need to add # at beginning and end.

would look something like

"#\\pdm\etc\etc\page.htm#"

Looks odd I know.

Also when you look at the hyperlink you cannot see the #'s either

Let me know how you get on

Len B
 

stpiepgr

Member
Local time
Today, 03:55
Joined
Nov 6, 2002
Messages
25
Len, your a life saver. Worked like a charm. I have been struggling over this for some time now trying to get the code right. This was much simpler.

Thanks again,

Steve
 

Len Boorman

Back in gainfull employme
Local time
Today, 03:55
Joined
Mar 23, 2000
Messages
1,930
Your welcome

It had me going for a while. I was doing constructing a drawing search application and I needed about 45,000 links.

Seemed simple to start with to set up a query to generate them but!!!!.

Anyway glad to help

Len B
 

Users who are viewing this thread

Top Bottom