Thanks Adam
There are a couple of options available to you.
Approach 1
------------
You can set the field as a hyperlink field, rather than a plain text
field. Then you'll automatically get the "pointing hand" cursor when
your mouse is over the field, and clicking it will automatically follow
the hyperlink. Unfortunately, Access generally assumes that anything
you enter in a hyperlink field is a web address, and prefixes the
address part of the hyperlink with "http://" unless you type in the
"mailto:" prefix. The way around this is to use code in the AfterUpdate
event of any control bound to this field, to replace the "http://"
prefix with "mailto:". Here's an example of such code:
'----- start of example #1 code -----
Private Sub EmailAddress_AfterUpdate()
If Not IsNull(Me.EmailAddress) Then
Me.EmailAddress = _
Replace(Me.EmailAddress, _
"http://", "mailto:", , , vbTextCompare)
End If
End Sub
'----- end of example #1 code -----
Approach 2
------------
Instead of a hyperlink field, use a plain text field for the e-mail
address. Use code in a suitable event -- the DblClick event of the
[EmailAddress] text box, or the Click of a command button -- to call the
Application.FollowHyperlink method to open the e-mail. In this case,
you'd add the "mailto:" prefix yourself. Here's example code:
'----- start of example #2 code -----
Private Sub EmailAddress_DblClick(Cancel As Integer)
Dim strEmail As String
If Not IsNull(Me.EmailAddress) Then
strEmail = Me.EmailAddress
If Left(strEmail, 7) <> "mailto:" Then
strEmail = "mailto: " & strEmail
End If
Application.FollowHyperlink strEmail
End If
End Sub
'----- end of example #2 code -----
If you really want the control to behave like a hyperlink field, you
could use the Click event of the text box, but I prefer not to do that,
as then I can't "click into" the field to edit it.
With this approach, the "hand" cursor won't automatically appear when
the mouse moves over the [EmailAddress] text box. You can make it do
that, if you really want to, by controlling the cursor yourself using
code from this link:
http://www.mvps.org/access/api/api0044.htm
in the MouseMove event of the control.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)