Quote:
| Originally Posted by roh710 Thanks June7, I will definitely give that a try. I will let you know how that goes.. Thanks again!  |
Thanks to pointing to the right direction, I was able to come up with following code. The code converts a report into a PDF file and attaches the files to an email with text body.
Thanks again!
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click
Dim stReportPathName As String
Dim stDocName As String
Dim stLinkCriteria As String
Dim stConfEmail As String
Dim stMessageText As String
stConfEmail = [ConfEmail]
stLinkCriteria = "[Order_ID]=" & Me![Order_ID]
stReportPathName = "C:\Documents and Settings\User\Desktop\OrderAcknowledgement-" & Me!Order_ID & Format(Date, "-MMDDYYYY") & ".pdf"
stDocName = "OrderAcknowledgement"
stMessageText = "Dear Customer -" & vbCrLf & vbCrLf & _
"Thank you for your recent order placed with Our Company. We are doing everything we are able to ship out your order on the same day." & vbCrLf & vbCrLf & _
"If you have any questions and/or concerns regarding your order, please contact us through below contact information." & vbCrLf & vbCrLf & _
" Telephone: (000) 000-0000" & vbCrLf & _
" Email: Orders@*****.Net" & vbCrLf & vbCrLf & _
"We would like to thank you again and your Order Acknowledgement is attached for your order confirmation." & vbCrLf & vbCrLf & _
"Yours Truly," & vbCrLf & "Customer Service"
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria, acHidden
DoCmd.SendObject acSendReport, "MSO_OrderAcknowledgement", acFormatPDF, _
stConfEmail, CC, "", "Order Acknowledgement Attached", stMessageText, True
Exit_cmdEmail_Click:
Exit Sub
Err_cmdEmail_Click:
MsgBox "Your email was not sent, please close and try again"
Me.Requery
Resume Exit_cmdEmail_Click
End Sub