email address in access 2003

D

daveyboy300

i have a form that has email address stored in it. how dow i set it up so
that when i click email address that it automaticlly starts outlook and adds
email address into the To line

many thanks in advance

dave
 
J

jwm

Following is a pretty simple send mail snippet. You can call it from a
command button OnClick event or from the field itself. The control
containing the email address in this instance is "txtEmailAddress."


Private Sub SendEmail_Click()
On Error GoTo Err_SendEmail_Click

Dim strToWhom As String

'First check there are names in the table to send it to

If IsNull(txtEmailAddress) Then
MsgBox "There is no e-mail address to send email to!", vbOKOnly, "Error"
txtEmailAddress.SetFocus

Exit Sub

End If

strToWhom = txtEmailAddress.Value '<-- your combobox which holds e-mail here
or just "[email protected]"

DoCmd.SendObject , , , strToWhom, , , , strMsgBody, True

Exit_SendEmail_Click:
Exit Sub

Err_SendEmail_Click:
Select Case Err.Number
Case 0
Resume Next
Case Else
MsgBox Err.Number & ": " & Err.Description
End Select

Resume Exit_SendEmail_Click

End Sub
 
Top