473,395 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

create and email multiple reports

Here is what I have. I have a table with customer account numbers, a table with customer emails, and a query that creates a report on the customer’s equipment (Equipment Health Report). I need to keep my two tables seperate so I can't combine them into one table.

What I need is a way to have the report run by getting a customer account number, run the report, email the report to the customer, and then go get the second account number. I need this to repeat until all of the customers have received a report without any further input from me except to hit the outlook send button. I guess I need a macro but not sure.

P.S. – I’m a Visual Basic noob so please no techno speak.

Thanks
Jun 14 '13 #1

✓ answered by Seth Schrock

Sorry it took so long to respond. I've been very busy all weekend.

To create a file on your computer that you can attach to an email, you would use the DoCmd.OutputTo command (here is the MSDN website with the syntax for it: DoCmd.OutputTo Method). You would then need to keep track of the location and the file name you give it so that you can attach it.

For the email part, you will need to add a reference to Outlook. To do this, you need to open your VBA editor, open the Tools menu and select References. Scroll down to Microsoft Outlook x Object Library where the x is the version of Outlook you are running (2007 = 12.0, 2010 = 14.0, 2013 = 15.0, etc.) and put a checkmark in the box next to it. You now have access to all the Outlook commands in VBA.

For the email coding part, here is a link on how to generate an email with an attachment: Using Automation to Send a Microsoft Outlook Message. So what you need to do is loop through generating each report, get the email address of the recipient and the file path of the attachment and pass it to the function that sends the email.

5 5105
Seth Schrock
2,965 Expert 2GB
Actually, I think that VBA would be easier.

Having the email addresses and the account numbers in different tables will only work if there is a link between the tables (like a customer ID number).

Are you wanting to have the report be the email, or are you wanting the report to be an attachment? Both are possible, but the second method is more complicated.
Jun 14 '13 #2
@Seth Schrock
I need the report to be an attachment.
Jun 14 '13 #3
Seth Schrock
2,965 Expert 2GB
Sorry it took so long to respond. I've been very busy all weekend.

To create a file on your computer that you can attach to an email, you would use the DoCmd.OutputTo command (here is the MSDN website with the syntax for it: DoCmd.OutputTo Method). You would then need to keep track of the location and the file name you give it so that you can attach it.

For the email part, you will need to add a reference to Outlook. To do this, you need to open your VBA editor, open the Tools menu and select References. Scroll down to Microsoft Outlook x Object Library where the x is the version of Outlook you are running (2007 = 12.0, 2010 = 14.0, 2013 = 15.0, etc.) and put a checkmark in the box next to it. You now have access to all the Outlook commands in VBA.

For the email coding part, here is a link on how to generate an email with an attachment: Using Automation to Send a Microsoft Outlook Message. So what you need to do is loop through generating each report, get the email address of the recipient and the file path of the attachment and pass it to the function that sends the email.
Jun 17 '13 #4
Thanks Seth,

After a little trial and error I was able to get this to work.
Jun 17 '13 #5
Seth Schrock
2,965 Expert 2GB
Good! Glad I could point you in the right direction.
Jun 17 '13 #6

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

Similar topics

2
by: Sigurd Bruteig | last post by:
Hi all! I have a problem printing multiple reports. The code i use is: Dim stDocName As String stDocName = "rptInvoice" DoCmd.OpenReport stDocName, acNormal, , " = date()" The problem is that...
3
by: MHenry | last post by:
Hi, I have 30 separate Access reports to print to pdf files. Presently, I print these reports to Acrobat pdf files one report at a time. I am looking for some help, or a program or add-in...
7
by: Mega1 | last post by:
is this possable to send more than 1 report in one email
0
by: mr_doles | last post by:
I have finally got the hang of this ReportViewer control. The one question that I have is dealing with multiple reports. If I have, lets say, 10 rdlc reports should I have 10 WinForms to put them...
2
by: Thall | last post by:
Hey Gurus - I've seen a few solutions to this problem, but none of which I can do without a little help. Here's the situation The following code loops thru a sales report, using the sales rep ID...
0
by: PughDR | last post by:
As the subject of this topic suggestions I am trying to find a way to use ASP, SQL Server, Com+ and Crystal Reports 8.5 to Create Dynamic PDF Reports Over The Web, but the only article I found that...
2
by: JAB | last post by:
Hi, I have MS Exchange 2003 server on the same server i have host my website. I need a web page that people who interested to have theri own email account. I need an ASP .net web page to...
0
by: mgarg005SSRS | last post by:
My requirement is to create multiple reports (.rdlc) and show them using single report viewer control. A: User selects a report from drop down list. B: Depending on report name a report has to be...
5
by: MyWaterloo | last post by:
I am currently using... DoCmd.SendObject acReport, BactPDF, acFormatPDF, Me.Text199, , , "BacT Results " & Me.Report_Heading ...to email my report. I have now come up against a need to send...
1
by: Sidhu v | last post by:
How can create email id using shell_exec or exec in php.That is ,i want to create email id in my web application. anybody can help me. Thanks and regards By Sidhu
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.