Putting text email addresses into hyperlink fields 
Author Message
 Putting text email addresses into hyperlink fields

I have a table with e-mail addresses in a text field. I
want to insert the address into a hyperlink field in the

out the VBA protocol to insert the text version of the
e-mail address into the hyperlink field.  Any help
appreciated!

-John McE



Tue, 08 Nov 2005 10:46:57 GMT  
 Putting text email addresses into hyperlink fields

Quote:
> I have a table with e-mail addresses in a text field. I
> want to insert the address into a hyperlink field in the

> out the VBA protocol to insert the text version of the
> e-mail address into the hyperlink field.  Any help
> appreciated!

> -John McE

First, you should be aware that you don't actually *need* to put the
addresses into a hyperlink field to follow them as if they were
hyperlinks.  I have a form based on a table with a text field holding
e-mail addresses, and I use code like this to open a message to that
address when the text box is double-clicked:

'----- start of 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 code -----

However, if you need to set a hyperlink field, you could probably do it
like this:

    Dim strEmail As String

    If Not IsNull(Me.EmailAddress) Then
        strEmail = Me.EmailAddress
        If Left(strEmail, 7) <> "mailto:" Then
            strEmail = "mailto: " & strEmail
        End If
        Me.HyperlinkField = Me.EmailAddress & "#" & strEmail & "#"
    End If

I haven't tested that, though.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



Tue, 08 Nov 2005 11:15:37 GMT  
 Putting text email addresses into hyperlink fields
Thanks, I'll try these.  I'm very new at this and your
syntax tips look very helpful.  Underlying my question is a
form I am developing for a telephone/contact directory that
contains an e-mail hyperlink control.  A routine in the "On
Current" event inserts the e-mail address for the person
whose contact info you are viewing into the hyperlink
address property of the hyperlink control.  Works fine for
me; however, when I had a couple people who only have read
access to the network folder in which the .mdb is stored
test the form, the e-mail update didn't work--I guess the
direction to change the address property triggered some
signal that an attempt was being made to write to the form.
I use the same method to call up a picture of each
person--I'll tackle fixing that when I get the e-mail
figured out!
Quote:
>-----Original Message-----


>> I have a table with e-mail addresses in a text field. I
>> want to insert the address into a hyperlink field in the

figure
>> out the VBA protocol to insert the text version of the
>> e-mail address into the hyperlink field.  Any help
>> appreciated!

>> -John McE

>First, you should be aware that you don't actually *need*
to put the
>addresses into a hyperlink field to follow them as if they
were
>hyperlinks.  I have a form based on a table with a text
field holding
>e-mail addresses, and I use code like this to open a
message to that
>address when the text box is double-clicked:

>'----- start of 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 code -----

>However, if you need to set a hyperlink field, you could
probably do it
>like this:

>    Dim strEmail As String

>    If Not IsNull(Me.EmailAddress) Then
>        strEmail = Me.EmailAddress
>        If Left(strEmail, 7) <> "mailto:" Then
>            strEmail = "mailto: " & strEmail
>        End If
>        Me.HyperlinkField = Me.EmailAddress & "#" &
strEmail & "#"
>    End If

>I haven't tested that, though.

>--
>Dirk Goldgar, MS Access MVP
>www.datagnostics.com

>(please reply to the newsgroup)

>.



Thu, 10 Nov 2005 09:22:27 GMT  
 Putting text email addresses into hyperlink fields

Quote:
> Thanks, I'll try these.  I'm very new at this and your
> syntax tips look very helpful.  Underlying my question is a
> form I am developing for a telephone/contact directory that
> contains an e-mail hyperlink control.  A routine in the "On
> Current" event inserts the e-mail address for the person
> whose contact info you are viewing into the hyperlink
> address property of the hyperlink control.

You can do that, but my feeling is that it's overly complicated.  The
only advantage I see to using an actual hyperlink control is that you
automatically get the "hand" cursor when you mouse over it.  I have
never felt that's important (and you can change the cursor with code if
you really want), but to each his own.

Quote:
> Works fine for
> me; however, when I had a couple people who only have read
> access to the network folder in which the .mdb is stored
> test the form, the e-mail update didn't work--I guess the
> direction to change the address property triggered some
> signal that an attempt was being made to write to the form.
> I use the same method to call up a picture of each
> person--I'll tackle fixing that when I get the e-mail
> figured out!

If the .mdb is not split, I believe network users must have read, write,
create, and delete privileges in the folder for any Access database to
work properly.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



Fri, 11 Nov 2005 01:43:19 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. email-address in hyperlink-field

2. hyperlinks & email addresses

3. Hyperlinks and email addresses..

4. Hyperlink Address Field

5. Search and select text in email item, convert to hyperlink

6. Turning email text into a hyperlink

7. Putting Address-Fields into variable

8. Putting Field Data into an Email

9. IN Code - convert a field type from Text to Hyperlink in Access 97

10. Using text box bound to a hyperlink field

11. Email address in fields ?

12. Outputting email addresses from Access into BCC field

 

 
Powered by phpBB® Forum Software