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

  • Thread starter Thread starter Song Su
  • Start date Start date
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.
 
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...
 
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?
 
Back
Top