froggiebeckie
Registered User.
- Local time
- Today, 17:34
- Joined
- Oct 11, 2002
- Messages
- 104
This code is part of a module that runs a query and creates an Email based on fields in that query.
I want this piece of code to loop through a query and place the results of some fields in the message body and make attachments based on another field.
The attachments part works fine, but in the message body, it just writes over the previous record, so all I end up with is the last record.
For example if the query returns:
Grinder - Due - 10/15/09
Polisher - Due - 10/01/09
Only the Polisher info will show in the message body.
Any idea how to fix it?
In the interest of brevity I've included only the part of the module that applies to the body and attachments, because everything else is working fine.
Thanks for looking!
BeckieO
I want this piece of code to loop through a query and place the results of some fields in the message body and make attachments based on another field.
The attachments part works fine, but in the message body, it just writes over the previous record, so all I end up with is the last record.
For example if the query returns:
Grinder - Due - 10/15/09
Polisher - Due - 10/01/09
Only the Polisher info will show in the message body.
Any idea how to fix it?
In the interest of brevity I've included only the part of the module that applies to the body and attachments, because everything else is working fine.
Code:
'This gives it the body
Do Until MailList.EOF
MyMail.Body = MailList("equipment") & " - " & MailList("Freq") & " Day " & MailList("subject") & " - Due " & MailList("DueDate") & vbCrLf
'This gets the attachments
Attach = MailList("Attachment File Path")
MyMail.Attachments.Add Attach
MyMail.Display
'And on to the next one...
MailList.MoveNext
Loop
Thanks for looking!
BeckieO