By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,830 Members | 682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,830 IT Pros & Developers. It's quick & easy.

Create long string from query result?

P: n/a
I'm trying to create an email mailing list for Outlook.

Here's the part of the sub that puts the email address in the Bcc (or To)
field:

With objNewMail
.BCC = strEmail
.Display
End With

I'm wondering if I can create one long comma-delimited string for "strEmail"
that is the result of a query.

.... was also thinking a For loop might work... ???

any help is greatly appreciated!

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I think this might work...

Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryEmailList")
Do Until rst.EOF
strEmail = strEmail & rst!EmailAddress & ";"
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
"deko" <dj****@hotmail.com> wrote in message
news:92****************@newssvr27.news.prodigy.com ...
I'm trying to create an email mailing list for Outlook.

Here's the part of the sub that puts the email address in the Bcc (or To)
field:

With objNewMail
.BCC = strEmail
.Display
End With

I'm wondering if I can create one long comma-delimited string for "strEmail" that is the result of a query.

... was also thinking a For loop might work... ???

any help is greatly appreciated!

Nov 12 '05 #2

P: n/a
"deko" <dj****@hotmail.com> wrote in message news:<3H*******************@newssvr25.news.prodigy .com>...
I think this might work...

Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryEmailList")
Do Until rst.EOF
strEmail = strEmail & rst!EmailAddress & ";"
rst.MoveNext
Loop
rst.Close
Set rst = Nothing

Yes, you could either do that or just add the address to the
Recipients collection (any of Cc, Bcc, or To) BTW, I think your
strEMail line should be

Do Until rst.EOF
strEMail = strEMail & ";" rst!EMailAddress
rst.MoveNext
Loop
rst.Close
set rst=nothing

strEMail = right$(strEMail,Len$(strEMail)-1)) ... cuts off the first ;
Nov 12 '05 #3

P: n/a
thanks for the tip.

I tried adding each email to the Bcc collection - but couldn't for some
reason. that's why I resorted to this method...

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
"deko" <dj****@hotmail.com> wrote in message

news:<3H*******************@newssvr25.news.prodigy .com>...
I think this might work...

Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryEmailList")
Do Until rst.EOF
strEmail = strEmail & rst!EmailAddress & ";"
rst.MoveNext
Loop
rst.Close
Set rst = Nothing

Yes, you could either do that or just add the address to the
Recipients collection (any of Cc, Bcc, or To) BTW, I think your
strEMail line should be

Do Until rst.EOF
strEMail = strEMail & ";" rst!EMailAddress
rst.MoveNext
Loop
rst.Close
set rst=nothing

strEMail = right$(strEMail,Len$(strEMail)-1)) ... cuts off the first ;

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.