farhanleos
Registered User.
- Local time
- Yesterday, 16:22
- Joined
- Oct 19, 2017
- Messages
- 38
Greetings ,
Gentlemen i am using below code on all command buttons to execute the report in pdf format , but i got Error while i did the same with the report which is based on Query and i have filter criteria on query?
Please guide if anybody have solution for this
ERROR : Runtime Error '2509'
MicrosoftAccess cannot find the object '|1'.
on Debug it leads to this script
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
Actual script using for :
Private Sub Command50_Click()
''''Open C1 Projects Under P&TSD/CPM Report in Pdf'''
'initialize variables
Dim strReportName As String
Dim strPathUser As String
Dim strFilePath As String
'set variables
strReportName = "006-C1 Projects Under P&TSD-CPM"
strPathUser = Environ$("USERPROFILE") & "\my documents"
strFilePath = strPathUser & strReportName & Format(Date, "yyyymmdd") & ".pdf"
'export to PDF/EXCEL
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
'launch excel file
Dim Shex As Object
Set Shex = CreateObject("Shell.Application")
Shex.Open (strFilePath)
End Sub
Gentlemen i am using below code on all command buttons to execute the report in pdf format , but i got Error while i did the same with the report which is based on Query and i have filter criteria on query?
Please guide if anybody have solution for this
ERROR : Runtime Error '2509'
MicrosoftAccess cannot find the object '|1'.
on Debug it leads to this script
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
Actual script using for :
Private Sub Command50_Click()
''''Open C1 Projects Under P&TSD/CPM Report in Pdf'''
'initialize variables
Dim strReportName As String
Dim strPathUser As String
Dim strFilePath As String
'set variables
strReportName = "006-C1 Projects Under P&TSD-CPM"
strPathUser = Environ$("USERPROFILE") & "\my documents"
strFilePath = strPathUser & strReportName & Format(Date, "yyyymmdd") & ".pdf"
'export to PDF/EXCEL
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFilePath
'launch excel file
Dim Shex As Object
Set Shex = CreateObject("Shell.Application")
Shex.Open (strFilePath)
End Sub