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
> 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.
cmichaud@ufl.edu - 28 Mar 2006 17:15 GMT
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?
> Something like this:
>
[quoted text clipped - 22 lines]
> >
> > Can you help...please.
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?
> 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.