I have a split form that can be filtered with a combo box. It filters out all "counties" and then shortens the list for me.
Now I have the following code attached to a Send E-mail button:
Code:
Dim oOutlook As Object
Dim oMail As Object
Dim strAddr As String
Dim MyDB As DAO.Database
Dim rstEMail As DAO.Recordset
Set oOutlook = CreateObject("Outlook.Application")
Set oMail = oOutlook.CreateItem(0)
'Retrieve all E-Mail Addressess in tblEMailAddress
Set MyDB = CurrentDb
Set rstEMail = MyDB.OpenRecordset("Contractors", dbOpenSnapshot, dbOpenForwardOnly)
With rstEMail
Do While Not .EOF
'Build the Recipients String
strEMail = strEMail & ![Email] & ";"
.MoveNext
Loop
End With
'--------------------------------------------------
With oMail
.Bcc = Left$(strEMail, Len(strEMail) - 1) 'Remove Trailing ;
.Body = "Test E-Mail to Multiple Recipients"
.Subject = "Yada, Yada, Yada"
.Display
End With
Set oMail = Nothing
Set oOutlook = Nothing
rstEMail.Close
Set rstEMail = Nothing
How do I have the recordset open only the filtered recordset and not the entire table?