Pauline123
Registered User.
- Local time
- Today, 05:22
- Joined
- Apr 1, 2013
- Messages
- 69
Hi all, got a bit of a tricky one here. We have recently upgraded to Office 2016 but still running Access 2007. Have the following code set to email a report in PDF format via a button as follows:
Private Sub Command86_Click()
Dim myOb As Object
Dim AutoSend As Boolean
Dim stDocName As String
stDocName = "EPSupplierOrders"
FileName = Application.CurrentProject.path & "\EPSupplierOrders_" & ".pdf"
DoCmd.OutputTo acReport, "EPSupplierOrders", acFormatPDF, FileName, True
Set myOb = CreateObject("Outlook.Application")
Set oMail = myOb.CreateItem(olMailItem)
'Set whether to send email automatically or make user press Send
AutoSend = False
With oMail
.Subject = "On Hire Notification"
.Attachments.Add FileName
If AutoSend Then
.Send
Else
.display
End If
End With
Set oMail = Nothing
Set oApp = Nothing
End Sub
Every time someone tries to email this report the following error message appears: Run Time Error 2282: The format in which you are attempting to output the current object is not available.
When I check the debug it highlights this line of the coding:
DoCmd.OutputTo acReport, "EPSupplierOrders", acFormatPDF, FileName, True
Any ideas to a solution !! Many thanks Pauline
Private Sub Command86_Click()
Dim myOb As Object
Dim AutoSend As Boolean
Dim stDocName As String
stDocName = "EPSupplierOrders"
FileName = Application.CurrentProject.path & "\EPSupplierOrders_" & ".pdf"
DoCmd.OutputTo acReport, "EPSupplierOrders", acFormatPDF, FileName, True
Set myOb = CreateObject("Outlook.Application")
Set oMail = myOb.CreateItem(olMailItem)
'Set whether to send email automatically or make user press Send
AutoSend = False
With oMail
.Subject = "On Hire Notification"
.Attachments.Add FileName
If AutoSend Then
.Send
Else
.display
End If
End With
Set oMail = Nothing
Set oApp = Nothing
End Sub
Every time someone tries to email this report the following error message appears: Run Time Error 2282: The format in which you are attempting to output the current object is not available.
When I check the debug it highlights this line of the coding:
DoCmd.OutputTo acReport, "EPSupplierOrders", acFormatPDF, FileName, True
Any ideas to a solution !! Many thanks Pauline