Solved

Hyperlink Not Working in Unbound Textbox

Posted on 2003-12-03
8
1,695 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 250 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

630 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