On Error GoTo Err_Command15_Click
' Dim stDocName As String
'
' stDocName = "Macro2"
' DoCmd.RunMacro stDocName
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
Dim strSQL As String
strSQL = "SELECT EmailAddress FROM Members WHERE " _
& "Interest1 = '" & [Forms]![Interests]![Combo8] & "' " _
& "OR Interest2 = '" & [Forms]![Interests]![Combo8] & "' " _
& "OR Interest3 = '" & [Forms]![Interests]![Combo8] & "' " _
& "OR Interest4 = '" & [Forms]![Interests]![Combo8] & "' " _
& "OR Interest5 = '" & [Forms]![Interests]![Combo8] & "' " _
& "OR Interest6 = '" & [Forms]![Interests]![Combo8] & "'"
Set MyDb = CurrentDb()
Set rsEmail = MyDb.OpenRecordset(strSQL, dbOpenSnapshot)
With rsEmail
.MoveFirst
Do Until rsEmail.EOF
If IsNull(!EmailAddress) = False Then
sToName = sToName & !EmailAddress & ";"
sSubject = "Subject"
sMessageBody = "Email Body"
End If
.MoveNext
Loop
Debug.Print sToName
DoCmd.SendObject acSendNoObject, , , _
sToName, , , sSubject, sMessageBody, True, True
End With
Exit_Command15_Click:
Set MyDb = Nothing
Set rsEmail = Nothing
Exit Sub
Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click