Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink Help

Status
Not open for further replies.

Igawa29

MIS
Jan 28, 2010
99
US
OK so I have been using DLookUp, and it works for everything I need on the form, except for the clickable hyperlink.

I have checked the following:

Table field: Is Hyperlinked
Query: Hyperlink pulls in correctly

So I need something in my text or list box that can give me a clickable hyperlink.

I have heard about HyperlinkPart, but I am not sure if this is what I need or how to define my query based on this.

Here is the Dlookup that I need to edit to get to work for hyperlinks.

Code:
=DLookUp("Link","TC_Lib","[Sort_Field] = '" & Forms!TC_Library!Report & "'")
 
on the text box set the "is hyperlink" property to "yes
 
Yes I made sure to set it as yes. Maybe it is because of my link format, but I need to be able to show the short link for this box.

Code:
Report34#\\mux2004\lan\Reporting\Reports/PROGRAM/detail.sas#

This link works perfectly in the query, however when I try to bring it into the text box it just lists the entire mess.
 
Are you saying that the "is hyperlink" property of the textbox on the form is set to yes?
Because in my case if it is set to "no" it shows the complete hyperlink like:
Report34#\\mux2004\lan\Reporting\Reports/PROGRAM/detail.sas#

but if I set it to "yes" it shows only the short "clickable" hyperlink.
 
Yep just tried it again and its showing in my text box as:

Report34#\\mux2004\lan\Reporting\Reports/PROGRAM/detail.sas#

It's blue and it's underlined, but the link isn't clickable, and I just want the Report 34 to show.
 
Here are two textboxes with the same controlsource. It is a dlookup returning a hyperlink. The first has "is hyperlink" set to "No" the second has it set to "Yes."
IMG
 
I cannot explain why it does not work, but here would be the total workaround.

if you want to display only the display text then build a custom function to use as the text box control source.


Code:
Public Function getDisplayText()as string
  getDisplayText = HyperlinkPart(dlookup("Link","TC_Lib","[Sort_Field] = '" & Forms!TC_Library!Report & "'"), acDisplayText)
End Function
set the text box control source to
=getDisplayText()

Then in the text box click event
Code:
Private Sub Text4_Click()
 FollowHyperlink (HyperlinkPart(dlookup("Link","TC_Lib","[Sort_Field] = '" & Forms!TC_Library!Report & "'"), acAddress))
End Sub

You can format the text box to blue and underlined. It worked for me, but you should not have to do it.
 
Perfect.. not sure why the first code didn't work ... might be user error on my part but the work around did the trick. The only problem is now when I hit cancel on the hyperlink, I get a runtime error. Do you know a way around this? If not I can see if I can figure it out.

Thanks again!
 
Fixed it with some Err commands.

Thanks again for everything else
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top