I currently have this selector form for customers with unpaid invoices.
This allows a report to be generated based on the selected CustomerID, then emailed to the customer using this, which works a treat.
I now want to be able to be able to send reports to any customers with ticks in 'Requested Email', all in one operation.
This allows a report to be generated based on the selected CustomerID, then emailed to the customer using this, which works a treat.
Code:
Private Sub cmdStore_Click()
Dim FileName As String
Dim FilePath As String
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
FileName = "Unpaid Items"
FilePath = "C:\Users\David\Documents\" & FileName & ".pdf"
'Create temporary file
DoCmd.OutputTo acOutputReport, "rptDebtorsStatement-copy", acFormatPDF, FilePath
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(olMailItem)
With oEmailItem
.To = Me.sfmDebtorList.Form.[E-Mail]
.CC = ""
.Subject = "Debtor Items"
.Attachments.Add FilePath
.Display
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
Kill FilePath
End Sub
I now want to be able to be able to send reports to any customers with ticks in 'Requested Email', all in one operation.