Hi I have been able to successfully send e-mails using MS Outlook via MS Access. However I can't seem to find any error logging techniques. What I want to do is create a log of any e-mails actually sent. I have no way of knowing whether an e-mail has or has not been sent, e.g. Line 34 in the below code will run regardless of whether the e-mail has been sent or not.
Thank You
P.S. Just for reference here's my code
Thank You
P.S. Just for reference here's my code
Code:
Dim strEmail As String
Dim strMsg As String
Dim oLook As Object
Dim oMail As Object
Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.CreateItem(0)
With oMail
.To = "iheartvba@vbassocool.com"
.Subject = "HO Report From Office Number " & strOfficeID & " From " & (Me.cboStartDate + 1) & " To " & (Me.tbEndDate - 1)
.Attachments.Add ("C:\HoXpt\qryXptTblChangeLogIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblClientAddressesIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblClientDetailsIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblClientDetailsUPD.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblCollectionsIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblCollectionsUPD.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblFFRBankDetailsIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblFFRBkChangeLogIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblFFRChangeLogIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblFFRIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblJobDetailsIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblJobDetailsUPD.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblJobPeriodsChangeLogIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblJobPeriodsIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblPendingItemsIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblPendingsChangeLogIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblTimeCardIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblVoidIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblYearsPerReceiptChangeLogIMP.txt")
.Attachments.Add ("C:\HoXpt\qryXptTblYearsPerReceiptIMP.txt")
.Send
End With
Set oMail = Nothing
Set oLook = Nothing
DoCmd.OpenQuery "qryAppXptDt"
MsgBox "Head Office Report Has Been Exported and E-mailed For The Period" & vbCrLf & (Me.cboStartDate + 1) & vbCrLf & "to" & vbCrLf & (Me.tbEndDate - 1)
End Sub
Comment