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