If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Exporting Reports from Access
How can I export several (11 or 12) reports from Access as on one email? I
can do it with a dozen but it is messy. |
#2
|
|||
|
|||
Exporting Reports from Access
Here are some links
http://www.granite.ab.ca/access/emai...ttachments.htm MSDN article on creating appointments, emails, etc., using Automation http://tinyurl.com/2knwj Q161088 Using Automation to Send a Microsoft Outlook Message http://support.microsoft.com/?id=161088 HOW TO: Use Automation to Send a Microsoft Outlook Message using Access 2000 http://support.microsoft.com/?id=209948 ACC97: How to Use a Recordset to Send Outlook E-Mail to Multiple Recipients http://support.microsoft.com/?id=318881 Also, have a look at Tony Toews' email page: http://www.granite.ab.ca/access/email.htm Or try this This is the complete Email code. I obtained this from one of the MVP's(Forgot which one). You first export the reports to a folder and then use the code below. You can also hardcode the name of the attachments or put them in a form. I have seen quite a bit of code for sending email. I have tried many of them. If you are just sending an Access report you can use the SendObject command. If attachments are files of any type try the code below. The one below( I have it stored as a function in a new module) has been the most reliable for me with MS Outlook and Access 2000. I have sent 5 attachments. I do not know if it can handle 13. Also I am able to pull from an open form email address of the recipient, CC, BCC, and the subject and text and file name of the attachment(s). To reference data on an open form use =[forms]![formname].[emailaddress] =[forms]![formname].[subject] =[forms]![formname].[attachment1] ect. Good Luck Function SendEMail() Dim strTo As String, strSubject As String, _ varBody As Variant, strCC As String, _ strBCC As String, strAttachment As String, _ strAttachment1 As String,strAttachment2 As String, _ strAttachment3 As String, strAttachment4 As String strTo = "email address" strSubject = "put subject here" varBody = "put message for body here" ' Add more strattachments if needed and modify IF statement ' below strAttachment = "attachment1" strAttachment1 = "attachment2" strAttachment2 = "attachment3" strAttachment3 = "attachment4" strAttachment4 = "attachment5" 'Start Outlook Dim olApp As Outlook.Application Set olApp = CreateObject("Outlook.Application") 'Logon Dim olNs As Outlook.NameSpace Set olNs = olApp.GetNamespace("MAPI") olNs.Logon 'Send a message Dim olMail As Outlook.MailItem Set olMail = olApp.CreateItem(olMailItem) 'Fill Out and Send Message olMail.To = strTo olMail.CC = strCC olMail.BCC = strBCC olMail.Subject = strSubject olMail.Body = varBody ' Modify these statements if more attachmewnts are needed If Len(strAttachment) 0 Then olMail.Attachments.Add (strAttachment) If Len(strAttachment1) 0 Then olMail.Attachments.Add (strAttachment1) If Len(strAttachment2) 0 Then olMail.Attachments.Add (strAttachment2) If Len(strAttachment3) 0 Then olMail.Attachments.Add (strAttachment3) If Len(strAttachment4) 0 Then olMail.Attachments.Add (strAttachment4) End If End if End if End if End If olMail.Send Set olNs = Nothing Set olMail = Nothing Set olApp = Nothing End Function "Baffled John" wrote: How can I export several (11 or 12) reports from Access as on one email? I can do it with a dozen but it is messy. |
Thread Tools | |
Display Modes | |
|
|