Quick way to put all records in email field of query in Bcc of Outlook

S

Song Su

Is there an easy and quick way to grab all the records in email field of
query to put in Bcc of Outlook's new message? Looping each record in the set
takes too long and user might think the computer stucks. I have 1,000+
records.

Thanks.
 
P

pietlinden

Is there an easy and quick way to grab all the records in email field of
query to put in Bcc of Outlook's new message? Looping each record in the set
takes too long and user might think the computer stucks. I have 1,000+
records.

Thanks.

How are you doing it? I would think opening a forward-only recordset
and appending the value to a string variable should work fine...

dim rsRecip as dao.recordset
set rsRecip = DBEngine(0)(0).Querydefs("qryMailMe").OpenRecordset
do until rsRecip.EOF
strRecip = strRecip & ", " & rsRecip.Fields("EmailAddress")
rsRecip.MoveNext
loop

rsRecip.close
set rsRecip=nothing
strRecip = Right$(strRecip, len(strRecip)-2)

then pass strRecip variable to your e-mail...
 
S

Song Su

Error shows at set rsRecip line: Run-Time error '3061' too few parameters
Expected 1

My query as follows:

SELECT DISTINCT Students.Instructor, Students.Sect, Students.BeginDate,
Students.YYYY, Students.Sem, Students.Subject, Students.Semester,
Students.email
FROM Students
WHERE (((Students.Sect)=[Forms]![frmCensus]![cboSection]));

How to modify when my query has criteria?

How are you doing it? I would think opening a forward-only recordset
and appending the value to a string variable should work fine...

dim rsRecip as dao.recordset
set rsRecip = DBEngine(0)(0).Querydefs("qryMailMe").OpenRecordset
do until rsRecip.EOF
strRecip = strRecip & ", " & rsRecip.Fields("EmailAddress")
rsRecip.MoveNext
loop

rsRecip.close
set rsRecip=nothing
strRecip = Right$(strRecip, len(strRecip)-2)

then pass strRecip variable to your e-mail...

Error shows at set rsRecip line: Run-Time error '3061' too few parameters
Expected 1

My query as follows:

SELECT DISTINCT Students.Instructor, Students.Sect, Students.BeginDate,
Students.YYYY, Students.Sem, Students.Subject, Students.Semester,
Students.email
FROM Students
WHERE (((Students.Sect)=[Forms]![frmCensus]![cboSection]));

How to modify it when my query has criteria?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top