Here are a couple of examples for you.
Note: this is untested code so it may have some typos, etc. but it should give
you a general idea of how you can do it.
Option 1) This will create a string of e-mail addresses and then open
a single instance of the Outlook e-mail editor with all the
addresses in the To: field
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strEMails As String
Dim i As Integer
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
strEMails = ""
With Me.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
.MoveFirst
End If
For i = 1 To .RecordCount
If strEMails <> "" Then strEMails = strEMails & "; "
If Len(.Email_Address) > 0 Then
strEMails = strEMails & .Email_Address
End If
.MoveNext
Next i
End With
With objEmail
.To = strEMails
.Subject = "Its Your Birthday Soon"
.Body = "Dear Customer, test, test, test"
.Attachments.Add "C:\Documents and
Settings\Compaq_Administrator\Desktop\Word\birthday letter.doc"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With
Exit_Here:
Set objEMail = Nothing
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
Option 2) This would open multiple instances (one for each recipient) of
the Outlook e-mail editor and you would need to send each one
separately.
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim i As Integer
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With Me.RecordsetClone
If .RecordCount > 0 Then
.MoveLast
.MoveFirst
End If
For i = 1 To .RecordCount
If Len(.Email_Address) > 0 Then
With objEmail
.To = .Email_Address
.Subject = "Its Your Birthday Soon"
.Body = "Dear Customer, test, test, test"
.Attachments.Add "C:\Documents and
Settings\Compaq_Administrator\Desktop\Word\birthday
letter.doc"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With
End If
.MoveNext
Next i
End With
Exit_Here:
Set objEMail = Nothing
Set objOutlook = Nothing
Exit Sub
Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here
End Sub
Again, these are untested examples. Be sure to make a backup of your db
before you implement any of the above.