Good Day
I found this piece of code and it does exactly what I need. It opens the email message in with the report attached as a .pdf, the problem I have is that it does not allow me to add any additional files to the email.
Can anyone perhaps assist me as to why this is happening and if I need to amend the code?
Code:
Private Sub Command32_Click()
On Error GoTo ErrorHandler
Me.Dirty = False
'This opens up the report based on the current view in the form
DoCmd.OpenReport "Printing Order", acViewPreview, , "[OrderID] =" & Me.OrderID
'This takes that open report and then attaches it to an email
DoCmd.SendObject acSendReport, , acFormatPDF, Forms![frm_Add_Orders]![Email], Subject:="Printing Order: " & [EmailSubject]
'Closes the open report after the email is sent.
DoCmd.Close acReport, "Printing Order", acSaveNo
MsgBox "Order Sent Successfully."
Cleanup:
Exit Sub
ErrorHandler:
Select Case Err.Number
Case 2501
DoCmd.Close acReport, "Printing Order", acSaveNo
MsgBox "Email was cancelled."
Case Else
MsgBox Err.Number & ": " & Err.Description
End Select
Resume Cleanup
End Sub