I'm trying to do something very similar. I get a different error when the email trys to send. The error I get is: "Unknown message recipient(s); the message was not sent." When I substitute 2 or more email addresses in double qoutes for the strEmail variable the code works. I used the "txtEmail" text box to make sure the value of the variable was correct before it passed to the SendObject command. (email1@test.co m; email2@test.com )
Could someone please take a look at this and tell me what you think? Thanks in advance!
My Code:
Could someone please take a look at this and tell me what you think? Thanks in advance!
My Code:
Code:
Dim stDocName As String stDocName = "rptTest" Dim rst As DAO.Recordset Dim strEmail As String Set rst = CurrentDb.OpenRecordset("SELECT emailAdd As EmailAddress FROM Emails") Do Until rst.EOF strEmail = strEmail & rst!EmailAddress & "; " rst.MoveNext Loop rst.Close Set rst = Nothing txtEmail.Value = strEmail DoCmd.SendObject acReport, stDocName, "RichTextFormat(*.rtf)", strEmail, "", "", "Here is the Test email Report", "", False, ""
Comment