email address in access 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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 "(e-mail address removed)"

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
 

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

Back
Top