473,714 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending an Access Report as an attachment via Outlook automatically

1 New Member
I'm trying to send an existing Access Report as an attachment via MS Outlook. The SendObject method is not an option.

Since, the report i'm trying to send is an access object it is not stored at a particular path on the PC/network.

Any help would be greatly appreciated! This is what I have tried so far but have been running out of options...
Expand|Select|Wrap|Line Numbers
  1. Dim objOutlook As New Outlook.Application
  2. Dim ObjOutlookMsg As Outlook.MailItem
  3.  
  4. Set ObjOutlookMsg = objOutlook.CreateItem(olMailItem)
  5. With ObjOutlookMsg
  6. .To = aRecipients
  7. .Subject = "test"
  8. .Body = "hi"
  9. .Body = "Body of email"
  10. .Attachments = aAttachments ( I believe this is where I need help)
  11. .Send
  12. End With
  13. Set ObjOutlookMsg = Nothing
  14. Set objOutlook = Nothing
Jan 23 '12 #1
4 12730
ADezii
8,834 Recognized Expert Expert
Here is Code that Saves a Report as an *.rtf File, Attaches the Report to an E-Mail addressed to JDoe@aol.com, then Sends the E-Mail via Outlook:
Expand|Select|Wrap|Line Numbers
  1. 'Set a Reference to the Microsoft Outlook ?X.X Object Library
  2. Dim strReportName As String
  3. Dim oLook As Object
  4. Dim oMail As Object
  5. Dim olns As Outlook.NameSpace
  6. Dim strTO As String
  7. Dim strMessageBody As String
  8. Dim strSubject As String
  9.  
  10. strReportName = "rptEmployees"
  11. DoCmd.OutputTo acOutputReport, strReportName, acFormatRTF, CurrentProject.Path & _
  12.                "\" & strReportName & ".rtf", False
  13.  
  14. Set oLook = CreateObject("Outlook.Application")
  15. Set olns = oLook.GetNamespace("MAPI")
  16. Set oMail = oLook.CreateItem(0)
  17.  
  18. '*********************** USER DEFINED SECTION ************************
  19. strTO = "JDoe@aol.com"
  20. strMessageBody = "Here is the Report that you requested"
  21. strSubject = "Test Project for Attaching Access"
  22. '*********************************************************************
  23.  
  24. With oMail
  25.  .To = strTO
  26.  .Body = strMessageBody
  27.  .Subject = strSubject
  28.  .Attachments.Add CurrentProject.Path & "\" & strReportName & ".rtf"
  29.    '.Display
  30.      .Send
  31. End With
  32.  
  33. Set oMail = Nothing
  34. Set oLook = Nothing
Jan 24 '12 #2
ChrisPadgham
11 New Member
it is quite simple really

Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject acSendReport, "MyReport", acFormatRTF, "theemail@emails.com", , , "Here is your report"
note if you are using a later version of access you can use acFormatPDF to present your report in PDF format
Jan 25 '12 #3
ADezii
8,834 Recognized Expert Expert
As stated by the OP:
The SendObject method is not an option.
Jan 25 '12 #4
ahafenbr
1 New Member
@ADezii
Hello, how would you modify this to send more than one report and also add more email recipients?
Mar 5 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
16589
by: Susan Bricker | last post by:
I would like to generate a report (I have the report working already) using MS/ACCESS 2000 and then have the ability to send the report as an email attachment to my colleagues. I have looked around in the MS/ACCESS Help facility and found that I can click on FILE (on the Menu Bar) and then click on SEND TO. This will generate, either, a 'Snapshot format' or 'Rich Text Format' file and send an email. Two problems: 1. Is it possible to...
15
13335
by: Mark C | last post by:
All, I have exhaustingly been looking through the newsgroups in search of a way to systemically output an Access 97 report to a pdf file using the full version of Adobe Acrobat. I want the user to be able to click a button and have the Access report saved as a pdf in a directory specified by me the programmer. I have seen a posting by John Baker promoting a web-sight that has an mde that one can reference in any database but after 30...
1
2509
by: Aby Mathews | last post by:
I am using Cutepdf to convert access report to pdf format. It's working fine. How can I set the save location and save as file by default and how can I attach this file automatically to outlook. Please help me with full code. Thanks *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
0
1242
by: Bob Alston | last post by:
I am having trouble on a client PC getting the Office link, to send an access report I am viewing to MS Word. Also I cannot get send to - mail recipient to work either. The command box pops up as usual but just hangs and never completes. On my home Win xp Office 2003 it works just fine. My client has Win XP and Office 2002.
1
1635
by: Dirk Goossens | last post by:
Hello! I'm sending E-mails to mailadresses in a table, using the code below. How can I send more than one attachment? Access can find the file to be send in this field: MY_EMAILATTACHMENT_FIELD I have also a field with the name MY_EMAILATTACHMENT_FIELD2 Combining the field names with an &-sign doesn't work, even when I put a ; in between. Thanks for a helping hand!
5
539
by: handokowidjaja | last post by:
Hi All, I'm trying to automate sending an email with an attachment in our environment (access 97) using Outlook Express ( we dont have MS outlook or other fancy stuff). Does anybody knows how to do this, please help! The only reference i can found in my access97 program is Microsoft CDO for Windows 2000, however i've been searching for some sample to make this work without any result. Please help. Thank you in advance.
4
2958
akabir77
by: akabir77 | last post by:
Hi I am using the following code to convert a access report into HTML format and then sending it via email. DoCmd.SendObject _ acSendReport, _ "rptQC-Div-email", _ acFormatHTML, _ rs!email, _ , _
2
2195
by: neosam | last post by:
Hi, Could someone tell me if the code i have written has the correct syntax. DoCmd.SendObject acSendReport as acSpreadSheetType , "reportname", , "email@id.com", , , "report", "Pls find Report",,
1
1896
by: shalskedar | last post by:
My Query is Can we create an exe file specifically for Ms Access Report because In my Database(Acess 2003)I need to send 1 of the Report as an attachment via Ms Outlook. If I try to send this Report as attachment,it opens with Ms Excel.But i require the same format as that of the Access.Thus I need to do this using Access. Can any one let me know how to convert this Report to an exe file so that i can send it as an attachment or is there...
5
4583
MDestructive
by: MDestructive | last post by:
First, let me say that VBA is not my strong point but I have been bestowed with creating a duplicate database of a former employee who sabotaged the original. And everyday this isn't working is creating a ton of manual work for other people. I have managed to get the entire database working with the exception of the final step. Basically, you click three buttons, the first button imports many text files using the Open File Dialog window...
0
8817
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8715
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9086
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9037
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5964
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4734
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3170
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.