accumulate contents of a text field in the records of a select que

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

One of the fields in my select query contains email addresses. In any given
record, it may be blank, contain one email address, or more than one email
address each separated by a comms. I want to accumulate all of the email
addresses from all of the records into a memo field or variable so that I can
then use that field or variable in my navigate function to bring up my
default email program to send an email to all of those email addresses
 
In VBA, you could:
1. Open a recordset on the SQL statement.
2. Loop through all records in the recordset accumulating the text in the
email field into a string variable.
3. If Outlook is your email program, start Outlook (using Automation) and
create an email automatically.
4. If you don't want everybody to see everybody else's email address,
send the email (say) to yourself and put everybody else's email address in
the bcc field.
5. If you complete the body text of the email (from VBA), you could send
it automatically. Alternatively, you may wish to finish the VBA code here
and write the email manually before clicking Send/Receive.
In my experience, email addresses won't be completed correctly in the
database and your email program will complain when you try to send it.
Outlook will underline all good addresses, so you may want to look at the
email's "To" (or "bcc") field to check for email addresses that are not
underlined before sending manually.

Geoff
 
Back
Top