Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 1st, 2013, 01:25 AM
roh710 roh710 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 19 roh710 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 55 m 33 sec
Reputation Power: 0
Send Report via Email

I am trying to send invoices via email.

I have an invoice form and once the form is filled in, I can create invoice with click of command button.

What I want to do from this point is to create another command button for emailing the Invoice (Report) as an attachment (PDF) to the customer's email address already in the form, in a following format:

Dear [Customer's name]:

[Email body]

ABC Co
123 main st
anytown, USA

Can anyone help to achieve this task?

Thank you in advance!

Keith-R

Reply With Quote
  #2  
Old February 1st, 2013, 08:24 PM
June7's Avatar
June7 June7 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Location: The Great Land
Posts: 256 June7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 9 h 29 m 29 sec
Reputation Power: 5
Try the SendObject method.
http://msdn.microsoft.com/en-us/lib...office.12).aspx

If that is not adequate will require code that opens Outlook objects and manipulates message object. With that approach will have to first save the invoice report as a PDF file and then attach the external file to the Outlook message object.

Example of saving report as PDF:
DoCmd.OutputTo acOutputReport, "", acFormatPDF, strPath & rs!Labnum & ".pdf", False
__________________
I like to know if my suggestion helped you. One way to let me know is by clicking scales at top right corner of post.
Debug!Debug!Debug!http://www.cpearson.com/excel/debug.htm

Reply With Quote
  #3  
Old February 1st, 2013, 09:23 PM
roh710 roh710 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 19 roh710 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 55 m 33 sec
Reputation Power: 0
Quote:
Originally Posted by June7
Try the SendObject method.
http://msdn.microsoft.com/en-us/lib...office.12).aspx

If that is not adequate will require code that opens Outlook objects and manipulates message object. With that approach will have to first save the invoice report as a PDF file and then attach the external file to the Outlook message object.

Example of saving report as PDF:
DoCmd.OutputTo acOutputReport, "", acFormatPDF, strPath & rs!Labnum & ".pdf", False


Thanks June7, I will definitely give that a try. I will let you know how that goes.. Thanks again!

Reply With Quote
  #4  
Old February 2nd, 2013, 11:56 AM
roh710 roh710 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 19 roh710 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 55 m 33 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Send Report via Email


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap