Thanyellin
IS-IT--Management
I have built this routine and everything works except for the attachment. Any suggestions?
Code:
Private Sub Command22_Click()
Dim otk As Outlook.Application
Dim eml As Outlook.MailItem
Dim rs As ADODB.Recordset
' Open your table and build your distribution list
Set rs = New ADODB.Recordset
With rs
.Open "Student_Data1", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
.MoveFirst
Do While Not .EOF
Set otk = CreateObject("Outlook.Application")
Set eml = otk.CreateItem(olMailItem)
eml.To = .Fields("Email")
eml.Subject = .Fields("Subject")
eml.Body = .Fields("Body")
[COLOR=red]eml.Attachments.Add = .Fields("Attachment")[/color]
eml.Display
.MoveNext
Loop
.Close
End With
otk.Quit
Set otk = Nothing
End Sub