Need Multiple entries in Email Message Body

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.
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
 
Try:

MyMail.Body = MyMail.Body & vbCrLf & MailList("equipment") & ...
 
Works like a charm.
Started out thinking "Why would that work?" After a couple of seconds the lightbulb came on.

Thanks so much.

BeckieO
 
Sometimes it just takes another pair of eyes. Glad it worked for you.
 

Users who are viewing this thread

Back
Top Bottom