Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hyperlink Not Working in Unbound Textbox

Posted on 2003-12-03
8
Medium Priority
?
1,699 Views
Last Modified: 2007-12-19

I'm using unbound forms which use code to load data from tables and/or queries into the forms' various controls, mostly being textboxes.  Currently I have a Access 2000 mdb but expect later to move to SQL Server, and thus want to store hyperlinks as text data types rather than hyperlink data types (trying to reduce conversion headaches later).  I can't seem to get the hyperlinks to work.  Here's what I've done:

- I set the textbox's IsHyperlink property to True.  
- The textbox is unbound.
- I make the hyperlink value assignment to the textbox in code, in the form of:
      .... code gets hyperlink value from table...
      Me.txtHyper = "Wyatt#mailto: Wyatt@anyplace.com"    
- The textbox displays "Wyatt#mailto: Wyatt@anyplace.com" in blue underline, like a hyperlink.  But it doesn't display the "Wyatt" part alone as it normally should.
- When I go to the textbox, the pointed-finger icon doesn't appear and when I click nothing happens.

FYI, I've tried different variations of the hyperlink syntax, all with the same results.  

Any ideas on where I'm going wrong?

Thx,
Wyatt



0
Comment
Question by:WyattRidesAgain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 18

Expert Comment

by:bonjour-aut
ID: 9869497
Do this VBA:

Private Sub txtHyper_Click
 Application.FollowHyperlink(Me.txtHyperlink)
End Sub

assuming that the hyperlink is correct in the texbox

Regards, Franz
0
 
LVL 18

Accepted Solution

by:
bonjour-aut earned 750 total points
ID: 9869515
there is more sophisticated code too, if you prefer

you can paste that code to a module and use this publich function:

Public Function OpenHLink(target As String)
  Dim targeturl As String
  Dim linktype As Integer
  linktype = 0 'default
  If InStr(1, target, "\") > 0 Then linktype = 1 'local
  If InStr(1, target, "@") > 0 Then linktype = 2 'mail vv
  If InStr(1, target, "http://") > 0 Then linktype = 3 'tranparent
  Select Case linktype
   Case 0
      targeturl = "http://" & target
   Case 1, 3
      targeturl = target
   Case 2
      targeturl = "mailto:" & target
  End Select
  Application.FollowHyperlink (targeturl)
End Function

Regards, Franz
0
 

Author Comment

by:WyattRidesAgain
ID: 9870457
Franz,

Thanks for both the simple and the sophisticated versions of using Application.FollowHyperlink().  Very nice!  

But how do I get the mouse icon to change to the normal hyperlink pointer when it's over the textbox?  This is something that users always expect with hyperlinks.

Regards,
Wyatt
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 18

Expert Comment

by:bonjour-aut
ID: 9870848
Set The Hyperlink Property to true and asign the value to # without any quotes

the # stands for selfreference, so the built in hyperlink does not fire and the _Click event can fire

Regards, Franz
0
 

Author Comment

by:WyattRidesAgain
ID: 9871618
Franz,

Sorry, but I don't quite follow your comments about assigning a value to # and not having quotes.  Could you explain a bit more, or offer a code snippet to illustrate?

Much thanks,
Waytt
0
 
LVL 18

Expert Comment

by:bonjour-aut
ID: 9872755
Have a look at this example:

http://www.tplus.at/~sissi-franz/test/wwwhyperlink.mdb

on the testform you will find "otherLabeMethod"

look at its properties - this shows, what i mean

Regards, Faranz
0
 
LVL 18

Expert Comment

by:bonjour-aut
ID: 9872855
to change the mouse cursor over a text-field to a hand is a problem, as there is no hand in the mouse-poiter properties ( Screen.MousePointer = 1,3,..,11)

there is a pssibility for a custom one.
see http://p2p.wrox.com/archive/vba_access/2001-05/10.asp

regards, Franz
0
 

Author Comment

by:WyattRidesAgain
ID: 9881449

Franz,

Thanks for the help.  That gets me going!  Points are coming.

Regards,
Wyatt
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question