Email button code

R

renold1958

I have a database containing an email field. A form has
been created with this field in it. I have set properties
for this field to hyperlink.

I like to add a button to this form with ..Email..

What is the OnClick code for this button, so that when I
click on it, Outlook Express opens automatically with the
corresponding email address in the to:

Much obliged for any help
 
F

fredg

I have a database containing an email field. A form has
been created with this field in it. I have set properties
for this field to hyperlink.

I like to add a button to this form with ..Email..

What is the OnClick code for this button, so that when I
click on it, Outlook Express opens automatically with the
corresponding email address in the to:

Much obliged for any help

Change that field's datatype to Text, not Hyperlink.

Code the Form's Control's DOUBLE-CLICK event:
Application.FollowHyperlink "Mailto:" & [ControlName]
 
C

Cameron

renold1958 said:
I have a database containing an email field. A form has
been created with this field in it. I have set properties
for this field to hyperlink.

I like to add a button to this form with ..Email..

What is the OnClick code for this button, so that when I
click on it, Outlook Express opens automatically with the
corresponding email address in the to:

Much obliged for any help

This will open your default email application:

Dim strMessage As String 'Body of message
Dim strSubject as String 'Email Subject
Dim strTo as String 'To address
strTo="[email protected]"
strMessage = "Hi " & txtFirstName.Text & "," & vbCrLf & vbCrLf
strMessage = strMessage & "This is to let you know Blah, Blah, Blah"
DoCmd.SendObject acSendNoObject, , acFormatTXT, strTo, , , strSubject
, strMessage, True

-Cameron Sutherland
 
Top