I have a form that lists members. It includes an e-mail field. I've created a button control that will allow the user to send to all the members with e-mails or to a filtered list of e-mails. What I would like to do now is create a similar button that can send to either the entire list or a filtered list, but prior to sending I want to display a form to request input for the message body. This will be for quick messages, like a text message. Basically I want to filter the list, then click the button, a form will popup with one text box to type the message, the user enters the text, and then they hit send to send the message.
Here's the code I have now:
Dim strRS As String
strRS = "Select * FROM MembersExt "
Dim strWhere As String
strWhere = ""
If Me.FilterOn = True Then
strWhere = Me.Filter
strRS = strRS & " WHERE " & strWhere
End If
Dim appOutLook As Outlook.Application
Dim oEmailItem As MailItem
Dim rs As Recordset
Dim recipientList As String
If appOutLook Is Nothing Then
Set appOutLook = New Outlook.Application
End If
Set oEmailItem = appOutLook.CreateItem(olMailItem)
With oEmailItem
Set rs = CurrentDb.OpenRecordset(strRS)
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
If IsNull(rs![E-mail]) Then
rs.MoveNext
Else
recipientList = recipientList & rs![E-mail] & ";"
.BCC = recipientList
rs.MoveNext
End If
Loop
Else
MsgBox "No one in this group has an email address"
End If
Set rs = Nothing
.TO = ""
.CC = ""
.Subject = ""
.Display
End With
Set oEmailItem = Nothing
Set appOutLook = Nothing
Any suggestions