Query for Email Address Then send to Outlook

  • Thread starter Thread starter cmichaud
  • Start date Start date
C

cmichaud

I am trying to run a query that will return me email addresses based on
hobby. Then i want it to take all the cooresponding email addresses
and put them in the "to:" field of outlook. It can leave the rest of
the email blank. I have NO idea how to do this or even get started.


Can you help...please.
 
Something like this:

Dim rs as ADODB.recordset, strEmails as string, strSQL as string
strSQL = "SELECT MyEmail FROM MyTable WHERE MyHobby = 'Whatever'"
strEmails = vbnullstring
rs.Open strSQL,CurrentProject.Connection,adOpenForwardOnly,adLockReadOnly
while not rs.eof
if strEmails = vbnullstring Then
strEmails = rs.fields("MyEmail").value
else
strEmails = strEmails & ";" & rs.fields("MyEmail").value
end if
rs.movenext
wend
rs.close
set rs = nothing
' strEmails now contains the Emails string

-Dorian
 
where do i enter that in. and can i use a form to select the hobby for
the query....i mean i know i can, but can i use it with this. smell my
newness?
 
I am trying to do the same thing. If I do a select all, copy, paste . . .
the field name is included with the data. Is there a way to avoid the field
name from be included?
 
Back
Top