Question : Email Button In Access

Hi

I have created a form in access to hold contact details.  It stores email addresses.  Im looking to add a button below the email field to allow users to email that particluar contact.  So far I have set up the button and an invisible send button which on clicked opens a new email but it doesnt bring the email address in.  Heres my code for the button

_________________________________________________________________

Private Sub Command74_Click()
On Error GoTo Err_Command74_Click

    Dim stAppName As String

            Me.cmdSendEmail.Hyperlink.Address = "mailto:""
            Me.cmdSendEmail.Hyperlink.Follow
            g_sEmailAddresses = ""

Exit_Command74_Click:
    Exit Sub

Err_Command74_Click:
    MsgBox Err.Description
    Resume Exit_Command74_Click
   
End Sub
______________________________________________________________

I know that I can add a email address to the "mailto:" code part but this will be no good as I want to to email whatever contact shown.

The name of the Field for the email record is "Email"

Any help would be greatly appreciated. Im only a novice so please explain you answers if u can.  

Thanks!!

Answer : Email Button In Access

if you have a text field for email addresses, just add the following code behind your button

DoCmd.SendObject acSendNoObject, , , Me.email

additional options allow you to CC, add subject and text, plus you can also send an attachment if you so wish.

I'd also add a small chunk of code to ensure the email addres... is an email address! (checking for @ and dot etc)
Random Solutions  
 
programming4us programming4us