email from access

  • Thread starter Thread starter Meryl
  • Start date Start date
M

Meryl

I have a field that has a contact's email address. I
would like to turn that into a link, so that when the user
clicks on it, it opens Outlook Express and populates
the "To:" field with the email address.

thx.
 
There are a couple of ways to do this - making the field in your table a
Hyperlink type and editing the Hyperlink to make it a "mailto:" instead of
an "http:" link; or making the field in your table a text type and writing a
little bit of code to Automate it.

Personally, I think it is easier just to enter the email address in a
standard Text Box, simply because Access presumes that values entered into a
Hyperlink field are for web-site access and it is a pain to edit the
Hyperlink to make it a "mailto:".

In your text box containing the email address, you do not particularly need
to enter the "mailto:", and you can format the email address using a Blue
fore color and make it underscored so that it looks like a Hyperlink. Then,
in the Double Click event of that text box, you could insert the following
code:

Dim strEmail as String

strEmail = "mailto:" & Me.
Application.FollowHyperlink Address:=strEmail

Substitute your actual field name for EMail in the above code.

In the event that this is the first time that you will have to code an
event, here is how to do it:

In your form's design view, right-click on the text box containing the email
address, then select Properties from the pop-up menu. In the properties
sheet for that text box, find the DblClick event and click anywhere on that
line. You will see a downward pointing arrow at the right edge of the line.
Click it and select Event Procedure. Then, look for the small button to the
right of the downward pointing arrow which contains an ellipsis (three dots
....). Click this button to open the code window for the Dbl Click event.

When the code window is first opened, it will look like this:

Private Sub Email_DblClick(Cancel As Integer)

End Sub

You will want to insert the following lines after the "Private Sub
Email_DblClick(Cancel as Integer)" line

Dim strEmail as String

strEmail = "mailto:" & Me.[EMail]
Application.FollowHyperlink Address:=strEmail

Save and close the code window; save your form and return it to form view.
Double click on your text box email value and you should be fine.
 
Back
Top