If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Sending email to many recipients
I am using the following code to create an Outlook email to be sent to
a group of contacts. I get the error message 'Unknown message recipients: message not sent' pop up when I run the code. Any ideas why? Private Sub SendEmail_Click() Dim strDocName As String strDocName = "qmt_ucas_emails" DoCmd.OpenQuery strDocName On Error GoTo ErrHandle Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim strAddress As String Dim strBCC As String Set dbs = CurrentDb Set rst = dbs.OpenRecordset("t_Account Management data", dbOpenSnapshot) If rst.BOF = True And rst.EOF = True Then MsgBox "There must be an error in the query as there are no EMail Addresses listed!" GoTo ErrExit End If With rst .MoveFirst Do While Not .EOF strAddress = Nz(.Fields("UCASEmail").Value, "") If strAddress "" Then strBCC = strAddress & "; " .MoveNext Loop End With strBCC = strBCC DoCmd.SendObject acSendNoObject, , , , , strBCC, , , True ErrExit: Exit Sub ErrHandle: MsgBox Err.description Resume ErrExit Resume End Sub |
#2
|
|||
|
|||
Sending email to many recipients
I doubt this is the problem, but your line of code
If strAddress "" Then strBCC = strAddress & "; " should be If strAddress "" Then strBCC = strBCC & strAddress & "; " It's possible that you need to remove the final semi-colon from the string. I also believe you must specify a To value: that you cannot simply specify a BCC value. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "KLR" wrote in message ps.com... I am using the following code to create an Outlook email to be sent to a group of contacts. I get the error message 'Unknown message recipients: message not sent' pop up when I run the code. Any ideas why? Private Sub SendEmail_Click() Dim strDocName As String strDocName = "qmt_ucas_emails" DoCmd.OpenQuery strDocName On Error GoTo ErrHandle Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim strAddress As String Dim strBCC As String Set dbs = CurrentDb Set rst = dbs.OpenRecordset("t_Account Management data", dbOpenSnapshot) If rst.BOF = True And rst.EOF = True Then MsgBox "There must be an error in the query as there are no EMail Addresses listed!" GoTo ErrExit End If With rst .MoveFirst Do While Not .EOF strAddress = Nz(.Fields("UCASEmail").Value, "") If strAddress "" Then strBCC = strAddress & "; " .MoveNext Loop End With strBCC = strBCC DoCmd.SendObject acSendNoObject, , , , , strBCC, , , True ErrExit: Exit Sub ErrHandle: MsgBox Err.description Resume ErrExit Resume End Sub |
#3
|
|||
|
|||
Sending email to many recipients
No this still didn't make a difference. I am baffled!
KLR Douglas J. Steele wrote: I doubt this is the problem, but your line of code If strAddress "" Then strBCC = strAddress & "; " should be If strAddress "" Then strBCC = strBCC & strAddress & "; " It's possible that you need to remove the final semi-colon from the string. I also believe you must specify a To value: that you cannot simply specify a BCC value. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "KLR" wrote in message ps.com... I am using the following code to create an Outlook email to be sent to a group of contacts. I get the error message 'Unknown message recipients: message not sent' pop up when I run the code. Any ideas why? Private Sub SendEmail_Click() Dim strDocName As String strDocName = "qmt_ucas_emails" DoCmd.OpenQuery strDocName On Error GoTo ErrHandle Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim strAddress As String Dim strBCC As String Set dbs = CurrentDb Set rst = dbs.OpenRecordset("t_Account Management data", dbOpenSnapshot) If rst.BOF = True And rst.EOF = True Then MsgBox "There must be an error in the query as there are no EMail Addresses listed!" GoTo ErrExit End If With rst .MoveFirst Do While Not .EOF strAddress = Nz(.Fields("UCASEmail").Value, "") If strAddress "" Then strBCC = strAddress & "; " .MoveNext Loop End With strBCC = strBCC DoCmd.SendObject acSendNoObject, , , , , strBCC, , , True ErrExit: Exit Sub ErrHandle: MsgBox Err.description Resume ErrExit Resume End Sub |
Thread Tools | |
Display Modes | |
|
|