Question Locked

Email Issues in MS Access 2003

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a MS Access application that sends email to a list of recipients in a sub-form. This worked without issue in Lotus Notes but following a migration to Outlook I get a 'Run-time error '2295' (Unknown message recipient), an ideas? Here is the code:

Private Sub cmdEmail_Click()

Dim strBody As String
strBody = "You have just completed a training course and Technical Services would appriciate your participation in our 'Training Survey'" & vbCrLf & vbCrLf + "Training Course: " + Me.CourseName & vbCrLf & vbCrLf & "Trainer: " + Me.Trainer & vbCrLf & vbCrLf & "iCON URL:" & vbCrLf & vbCrLf & Me.IconURL + " " & vbCrLf & vbCrLf & vbCrLf & "Thankyou in advance for your participation." & vbCrLf & "" & vbCrLf & vbCrLf & " "
Dim strTitle As String
strTitle = "Training Course Survey"
Dim strAddress As String
Dim strCC As String

Dim rs As DAO.Recordset
Set rs = Me.EmailSurveysSubform.Form.Recordset

rs.MoveFirst
While Not rs.EOF
If Trim(rs.Fields("Email")) <> "" Then
strAddress = strAddress & rs.Fields("email").Value & "; "
'strAddress = rs.Fields("email").Value & "; "
End If
rs.MoveNext
Wend

DoCmd.SendObject , , , strAddress, strCC, , strTitle, strBody

End Sub

3 replies

by thumbsup2

Pay particular attention to where you are concatenating everything. Why are the plus signs in there?

Also, the whole string needs to be on one line unless you use the "continue" character.

by swelch_z

The issue wasn't with the body but with Outlooks dislike of no space between the semi colon and the previous email address in the string. Lotus Notes automatically inserted a space, Outlook did not. The solution was this:
Replace the following Value & "; " with Value & " :" Simply move the space.

This discussion is closed to new replies.