Hello clara87:
Normally our experts do not download unrequested files usually because we work in restricted situations so let's look at what we can do in the text.
My general advice is to avoid attachments when possible.
Looking at your query, I have the impression that you have:
- [Final]
-
[email] [name] [Plant] [partID]
-
[a@trashmail.com][Mr. A][Plant 1][Part 1]
-
[a@trashmail.com][Mr. A][Plant 1][Part 2]
-
[a@trashmail.com][Mr. A][Plant 1][Part 3]
-
[b@trashmail.com][Ms. B][Plant 2][Part 1]
-
[b@trashmail.com][Ms. B][Plant 2][Part 2]
-
[c@trashmail.com][Dr. A][Plant 3][Part 1]
-
(place a table in the [CODE/] format and use spaces to format columns)
> Using the word "Name" as a field name can lead to other issues, it's a reserved word
Problem names and reserved words in Access (Allen Browne)
Personally would rename that field to [CstmrName]
Also, I suspect that your database may not be normalized: (
Database Normalization and Table Structures)
I am guessing that you want to send something like
- To: a@trashmail.com
-
Frm: clara87comany@Widgets.com
-
Sbj: Your parts order
-
Message: Dear Mr. A
-
The following parts are on their way
-
[From] [Part]
-
[Plant 1] [Part 1]
-
[Plant 1] [Part 2]
-
[Plant 1] [Part 3]
DoCmd.SendObject can do this without too much fuss without the attachment by opening a record set against your query in vba, looping through the records building your string
If you really need the attachment then you really need to understand the application automation that I linked to in the other post
in either case, you will basically do the following
- pseudo-code
-
open record set
-
check for records, if at least one record start the build
-
read first record email
-
start loop
-
read the remaining field values and add to string
-
((and/or build the excel attachment))
-
move to next record
-
Read email and if different from initial email then send email
-
Loop
-
(if eof send the final email)
-
Close the record set
If you will attempt to build the code we can help you walk through it. There are several threads here dealing with opening and looping through record sets - use the search bar at the top of this page and keywords:
Access, Record set, Loop, email
See if any the returned threads are close to what you need and if so try to use and modify. If you run into issues you can post back a link to that thread and your current code (please use the [CODE\] formatting tool) so that we can work towards the goal.
Please check your
Bytes.com-Inbox: I'll send you a boilerplate with what I hope are useful resources for beginning Access developers.