Solved

Hyperlink Not Working in Unbound Textbox

Posted on 2003-12-03
8
1,673 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

749 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