Clickable Email Address Field

G

Guest

I have a field that contains email addresses for clients and I want it to be
a clickable link. How do I make it so I can click on it and it will open my
email client and starty a message to that person? I do know how to do it by
editing the hyperlink individually in the table view, but not setting it up
for all my data records so that when I enter a new email address, it is
clickable.

I have been working on this for a while. Please help.
 
A

Allen Browne

Is this field a Text field or a Hyperlink field?

If Hyperlink, Access will insert an http:// in front of the email address,
and it won't work correctly. It is possible to use HyperlinkPart() to parse
out the display name and address from the link and create it with a mailto:
prefix instead, but this is unnecessarily messy.

A better solution is probably just to store the value in a Text field. Then
use the SendObject action in the Click (or DblClick) event of the text box
on your form. If your field is named Email, this would be line to enter in
your event procedure:
DoCmd.SendObject acSendNoObject, To:= Me.Email
 
G

Guest

Allen,

Thanks for the tips. One problem. First of all, I am familiar with Access,
but not familiar with the Visual Basic portion of macros so you will have to
excuse me. When I entered the code you posted in my TEXT field (like you
mentioned), it did in fact start an email to the individual, but if I closed
the started email without sending it, it gave me an error. Specifically, it
says the following:

Run-time error '2501'
The SendObject action was cancelled

What do I do to prevent this error from happening?

Second thought: I also have a standard signature and etc that I use with
Microsoft Outlook, will this not pull up either on the started email from the
double click?

Thank you for your tips and I just want to make sure I get it right if
possible.

Justin
 
A

Allen Browne

Add error handling to the routine, and ignore error 2501.

Something like this:

Private Sub Email_DblClick(Cancel As Integer)
On Error Goto Err_Handler

DoCmd.SendObject acSendNoObject, To:= Me.Email

Exit_Handler:
Exit Sub

Err_Handler:
If Err.Number <> 2501 Then
MsgBox "Error " & Err.Number & " - " & Err.Description
End If
Resume Exit_Handler
End Sub


For more info in error handling, see:
http://allenbrowne.com/ser-23a.html

The signature issue depends on your email program. You can't modify that
from SendObject.
 
G

Guest

Tried this and couldn't make it work - my field is called [email address] and
I pasted the do command in as you said but I'm not familiar language.

Thanks,

John
 
A

Allen Browne

Firstly, open your table in design view, and make sure your [email address]
field is a Text type, not a Hyperlink type. Save. Close.

Then open your form in design view.
Right-click the text box, and choose Properties.
Set the DblClick property to:
[Event Procedure]
Click the Build button (...) beside that.
Access opens the code window.
Between the "Private Sub..." and "End Sub" lines, paste:
DoCmd.SendObject acSendNoObject, To:= Me.[email address]
Save the changes.
Open the form.
Double-click the [email address] control.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

jmuirman said:
Tried this and couldn't make it work - my field is called [email address]
and
I pasted the do command in as you said but I'm not familiar language.

Thanks,

John

Allen Browne said:
Is this field a Text field or a Hyperlink field?

If Hyperlink, Access will insert an http:// in front of the email
address,
and it won't work correctly. It is possible to use HyperlinkPart() to
parse
out the display name and address from the link and create it with a
mailto:
prefix instead, but this is unnecessarily messy.

A better solution is probably just to store the value in a Text field.
Then
use the SendObject action in the Click (or DblClick) event of the text
box
on your form. If your field is named Email, this would be line to enter
in
your event procedure:
DoCmd.SendObject acSendNoObject, To:= Me.Email
 
G

Guest

Thanks for your help - I got a 2501 run time error but found your answer in
another post - again - Thanks,

John

Allen Browne said:
Firstly, open your table in design view, and make sure your [email address]
field is a Text type, not a Hyperlink type. Save. Close.

Then open your form in design view.
Right-click the text box, and choose Properties.
Set the DblClick property to:
[Event Procedure]
Click the Build button (...) beside that.
Access opens the code window.
Between the "Private Sub..." and "End Sub" lines, paste:
DoCmd.SendObject acSendNoObject, To:= Me.[email address]
Save the changes.
Open the form.
Double-click the [email address] control.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

jmuirman said:
Tried this and couldn't make it work - my field is called [email address]
and
I pasted the do command in as you said but I'm not familiar language.

Thanks,

John

Allen Browne said:
Is this field a Text field or a Hyperlink field?

If Hyperlink, Access will insert an http:// in front of the email
address,
and it won't work correctly. It is possible to use HyperlinkPart() to
parse
out the display name and address from the link and create it with a
mailto:
prefix instead, but this is unnecessarily messy.

A better solution is probably just to store the value in a Text field.
Then
use the SendObject action in the Click (or DblClick) event of the text
box
on your form. If your field is named Email, this would be line to enter
in
your event procedure:
DoCmd.SendObject acSendNoObject, To:= Me.Email


I have a field that contains email addresses for clients and I want it
to
be
a clickable link. How do I make it so I can click on it and it will
open
my
email client and starty a message to that person? I do know how to do
it
by
editing the hyperlink individually in the table view, but not setting
it
up
for all my data records so that when I enter a new email address, it is
clickable.

I have been working on this for a while. Please help.
 
B

BruceM

You probably got the error when you canceled the e-mail without sending it.
You can trap that error.

jmuirman said:
Thanks for your help - I got a 2501 run time error but found your answer
in
another post - again - Thanks,

John

Allen Browne said:
Firstly, open your table in design view, and make sure your [email
address]
field is a Text type, not a Hyperlink type. Save. Close.

Then open your form in design view.
Right-click the text box, and choose Properties.
Set the DblClick property to:
[Event Procedure]
Click the Build button (...) beside that.
Access opens the code window.
Between the "Private Sub..." and "End Sub" lines, paste:
DoCmd.SendObject acSendNoObject, To:= Me.[email address]
Save the changes.
Open the form.
Double-click the [email address] control.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

jmuirman said:
Tried this and couldn't make it work - my field is called [email
address]
and
I pasted the do command in as you said but I'm not familiar language.

Thanks,

John

:

Is this field a Text field or a Hyperlink field?

If Hyperlink, Access will insert an http:// in front of the email
address,
and it won't work correctly. It is possible to use HyperlinkPart() to
parse
out the display name and address from the link and create it with a
mailto:
prefix instead, but this is unnecessarily messy.

A better solution is probably just to store the value in a Text field.
Then
use the SendObject action in the Click (or DblClick) event of the text
box
on your form. If your field is named Email, this would be line to
enter
in
your event procedure:
DoCmd.SendObject acSendNoObject, To:= Me.Email


message
I have a field that contains email addresses for clients and I want
it
to
be
a clickable link. How do I make it so I can click on it and it will
open
my
email client and starty a message to that person? I do know how to
do
it
by
editing the hyperlink individually in the table view, but not
setting
it
up
for all my data records so that when I enter a new email address, it
is
clickable.

I have been working on this for a while. Please help.
 
G

Guest

Some of my email addresses have HTTP in front and some don't. All were
entered the same way (without http). Changed properties to "IS Hyperlink
....Yes" and that still doesn't fix. Any ideas?

Allen Browne said:
Firstly, open your table in design view, and make sure your [email address]
field is a Text type, not a Hyperlink type. Save. Close.

Then open your form in design view.
Right-click the text box, and choose Properties.
Set the DblClick property to:
[Event Procedure]
Click the Build button (...) beside that.
Access opens the code window.
Between the "Private Sub..." and "End Sub" lines, paste:
DoCmd.SendObject acSendNoObject, To:= Me.[email address]
Save the changes.
Open the form.
Double-click the [email address] control.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

jmuirman said:
Tried this and couldn't make it work - my field is called [email address]
and
I pasted the do command in as you said but I'm not familiar language.

Thanks,

John

Allen Browne said:
Is this field a Text field or a Hyperlink field?

If Hyperlink, Access will insert an http:// in front of the email
address,
and it won't work correctly. It is possible to use HyperlinkPart() to
parse
out the display name and address from the link and create it with a
mailto:
prefix instead, but this is unnecessarily messy.

A better solution is probably just to store the value in a Text field.
Then
use the SendObject action in the Click (or DblClick) event of the text
box
on your form. If your field is named Email, this would be line to enter
in
your event procedure:
DoCmd.SendObject acSendNoObject, To:= Me.Email


I have a field that contains email addresses for clients and I want it
to
be
a clickable link. How do I make it so I can click on it and it will
open
my
email client and starty a message to that person? I do know how to do
it
by
editing the hyperlink individually in the table view, but not setting
it
up
for all my data records so that when I enter a new email address, it is
clickable.

I have been working on this for a while. Please help.
 
A

Allen Browne

Hi Nancy.

Use a Text type field, not a Hyperlink field.

Once you have opened the table in design view, and changed the field type,
if the addresses still have the http:// in front of them, you could:
- Create a query using this table.
- Change it to an Update query (Update on Query menu).
- In the Update row under the Email address field, enter:
Replace(, "http://", "mailto:")
- Run the query to make the change.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

[QUOTE="Nancy"]
Some of my email addresses have HTTP in front and some don't. All were
entered the same way (without http). Changed properties to "IS Hyperlink
...Yes" and that still doesn't fix. Any ideas?

[QUOTE="Allen Browne"]
Firstly, open your table in design view, and make sure your [email
address]
field is a Text type, not a Hyperlink type. Save. Close.

Then open your form in design view.
Right-click the text box, and choose Properties.
Set the DblClick property to:
[Event Procedure]
Click the Build button (...) beside that.
Access opens the code window.
Between the "Private Sub..." and "End Sub" lines, paste:
DoCmd.SendObject acSendNoObject, To:= Me.[email address]
Save the changes.
Open the form.
Double-click the [email address] control.

[QUOTE="jmuirman"]
Tried this and couldn't make it work - my field is called [email
address]
and
I pasted the do command in as you said but I'm not familiar language.

Thanks,

John

:

Is this field a Text field or a Hyperlink field?

If Hyperlink, Access will insert an http:// in front of the email
address,
and it won't work correctly. It is possible to use HyperlinkPart() to
parse
out the display name and address from the link and create it with a
mailto:
prefix instead, but this is unnecessarily messy.

A better solution is probably just to store the value in a Text field.
Then
use the SendObject action in the Click (or DblClick) event of the text
box
on your form. If your field is named Email, this would be line to
enter
in
your event procedure:
DoCmd.SendObject acSendNoObject, To:= Me.Email


message
I have a field that contains email addresses for clients and I want
it
to
be
a clickable link. How do I make it so I can click on it and it will
open
my
email client and starty a message to that person? I do know how to
do
it
by
editing the hyperlink individually in the table view, but not
setting
it
up
for all my data records so that when I enter a new email address, it
is
clickable.

I have been working on this for a while. Please help.[/QUOTE][/QUOTE][/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top