AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Auto Email

Using MS Access - Auto Email


Expert: Scottgem - 6/30/2009

Question
I have 2 very simple tables - one listing multiple supplier numeric IDs and associated email address in 2 seperate fields, the other many rows of sales data, unique by supplier id and a product number (many suppliers, many products). I am trying to create code that will automatically create an email by supplier, with an attachment (.xls or .csv)of their specific data from the sales table. I cannot work through how to connect the email address in a recordset loop, to creating a specific qry for that supplier and attaching that result to the email - can you help ?

Answer
Have you looked at the SendObject method? That allows you to send the results of a query as an XLS file to an e-mail address.

If you want to send a filtered recordset within a loop, then you will have to use a Querydef to define the query with a filter based on the supplier. As to the e-mail address you simply populate that paramter with the e-mail field from the current record.

If just sending a single e-mail to a selected supplier, you use a stored query that filters for the supplier selected on a form. You set the criteria for the supplierID using the syntax:

=Forms!formname!controlname

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.