Send email + attachment from Access 2000 - TechRepublic
General discussion
November 5, 2001 at 08:15 PM
ajd

Send email + attachment from Access 2000

by ajd . Updated 24 years, 7 months ago

I want to construct an email from an Access 2000 form.
The email already contains the subject and body from the form, and I want to automatically add an attachment that is listed as a path in one of th form’s controls.
Does anyone have some code to do this?
I would appreciate your help!

The code I have so far is:

Private Sub email_Click()
On Error GoTo Err_email_Click

Dim stDocName As String
Dim stSubject As String
Dim stBody As String

stSubject = [Forms]![Patient Registration]![FileNumber]
stBody = [Forms]![Patient Registration]![Firstname] + ” ” + [Forms]![Patient Registration]![FamilyName] + Chr(10) + “Birth Date: ” + [Forms]![Patient Registration]![datetxt] + Chr(10) + “Sex: ” + [Forms]![Patient Registration]![Sex] + Chr(10) + “Clinical History:” + Chr(10) + [Forms]![Patient Registration]![ClinicalData] + Chr(10) + Chr(10) + “Best regards,” + Chr(10) + [Forms]![Patient Registration]![submitted]

DoCmd.SendObject , , acFormatRTF, “user@our_domain.com”, , , stSubject, stBody, True

Exit_email_Click:
Exit Sub

Err_email_Click:
MsgBox Err.Description
Resume Exit_email_Click

End Sub

This discussion is locked

All Comments