E
ekomsky via AccessMonster.com
I'm using the code below to send to multiple recipients in a table. But it
only works for the first five recipients ? If i add more i only get hte
first one back ? does this have something to do with the length of the
string ? and how do i get around it, i have 40 recipients and i'm using Lotus
notes ?
Private Sub Command13_Click()
'Declaire Variables
Dim rs As New ADODB.Recordset
Dim strEmail As String
'Open ADO recordset change YourEmailTable to the name of the table or query
holding your emails
rs.Open "EmailListTable", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
'Clear strEmail Variable
strEmail = ""
'Start to loop through the recordset
Do While Not rs.EOF
'Build email string...change "emails" in "rs!emails" to the name of the field
in the table/query you specified earlier which holds the email address
strEmail = strEmail & rs!emails & ";"
'move to next record in recordset...go to beginning of loop and add the next
email of that record to the email string (strEmail)
rs.MoveNext
Loop
'Send email using SendObject...the "To" argument will be filled with the
values the constructed string "strEmail" holds
DoCmd.SendObject , , , strEmail, , , "test", "Test", True
'Close established references...clean up code
rs.Close
Set rs = Nothing
End Sub
only works for the first five recipients ? If i add more i only get hte
first one back ? does this have something to do with the length of the
string ? and how do i get around it, i have 40 recipients and i'm using Lotus
notes ?
Private Sub Command13_Click()
'Declaire Variables
Dim rs As New ADODB.Recordset
Dim strEmail As String
'Open ADO recordset change YourEmailTable to the name of the table or query
holding your emails
rs.Open "EmailListTable", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
'Clear strEmail Variable
strEmail = ""
'Start to loop through the recordset
Do While Not rs.EOF
'Build email string...change "emails" in "rs!emails" to the name of the field
in the table/query you specified earlier which holds the email address
strEmail = strEmail & rs!emails & ";"
'move to next record in recordset...go to beginning of loop and add the next
email of that record to the email string (strEmail)
rs.MoveNext
Loop
'Send email using SendObject...the "To" argument will be filled with the
values the constructed string "strEmail" holds
DoCmd.SendObject , , , strEmail, , , "test", "Test", True
'Close established references...clean up code
rs.Close
Set rs = Nothing
End Sub