Post code between CODE tags and indentation will be retained for easier readability. Need an End With below .Send.
Code:
Private Sub BtnTestEM_Click()Dim rs As DAO.Recordset
Dim fld As Field
Dim rc As Integer 'record counter'
Dim em As String ' email address'
Dim MsgTxt As String 'text of message'
Dim MsgSbj As String 'Subject of message'
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set rs = CurrentDb.OpenRecordset("qryMbrEmail")
If rs.RecordCount <> 0 Then
With rs
.MoveFirst
rc = 1
MsgTxt = Me.tbMsgTxt
MsgSbj = Me.tbSubject
While Not .EOF
em = rs.Fields("Email")
If Len(em) > 0 Then
em = rs.Fields("FirstName") & " " & rs.Fields("LastName") & " " & rs.Fields("Email")
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = em
.Subject = MsgSbj
.HTMLBody = MsgTxt
.Send
End With
End If 'end of If Len(em) > 0 Then
rc = rc + 1
.MoveNext
Wend ' end While Not .EOF
MsgBox "Sending e-mail is complete " & rc & " messages sent", vbInformation
End With 'end With rs
End If 'If rs.RecordCount <> 0
rs.Close
Set rs = Nothing
End Sub