Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
Public Function SendEmail() Dim db As DAO.Database Dim MailList As DAO.Recordset 'Events_Email will be the query showing current events Dim Event_Email As DAO.Recordset Dim MyOutlook As Outlook.Application Dim MyMail As Outlook.MailItem Dim SubjectLine As String Dim MyBody As textstream Dim MyBodyText As String Dim MyNewBodyText As String Dim StopRep As Variant Dim strStopRep As String Set MyOutlook = New Outlook.Application Set MyMail = MyOutlook.CreateItem(olMailItem) SubjectLine = "IMDL Event Log Report" & " " & Date Set db = CurrentDb() 'Setting mail list to look at the Email Address table Set MailList = db.OpenRecordset("Emailer_Address") Set Event_Email = db.OpenRecordset("Event_Email") Do Until MailList.EOF 'Set MyBody MyBodyText = "test" 'may be missing link Set MyMail = MyOutlook.CreateItem(olMailItem) MyMail.To = MailList("Email") MyMail.Subject = SubjectLine MyMail.Body = MyBodyText MyMail.Send MailList.MoveNext Loop Set MyMail = Nothing Set MyOutlook = Nothing MailList.Close Set MailList = Nothing db.Close Set db = Nothing End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.