Hi all folks,
here am I with my very first question for you.
I tried investigating by myself of course in this forum as well as over the net but couldn't find any useful hint to solve the problem I bumped into.
Here is detail of what happening...
1) I have created a form with a button whose function is (would be... :banghead to export a given already created and formatted REPORT
to PDF format and save it on my desktop.
The code behind the command button is the following:
Private Sub Comando0_Click()
On Error GoTo Err_Report_Click
'DoCmd.OpenReport "REPORT_CARBURANTI_LUG-AGO_2017", acViewPreview, acWindowNormal
'DoCmd.OutputTo acOutputReport, "REPORT_CARBURANTI_LUG-AGO_2017", acFormatPDF, "C:\DESKTOP\RPT.pdf", True
DoCmd.OpenReport "AN_VEICOLI", acViewPreview, acWindowNormal
DoCmd.OutputTo acOutputReport, "AN_VEICOLI", acFormatPDF, "C:\DESKTOP\ANV.pdf", True
DoCmd.Close , , acSaveYes
'DoCmd.OutputTo acOutputReport, "REPORT_CARBURANTI_LUG-AGO_2017", acFormatPDF, "C:\DESKTOP\REPORT_CARBURANTI_LUG-AGO_2017" & Format(Date, "mmddyyyy") & ".pdf"
Exit_Report_Click:
Exit Sub
Err_Report_Click:
If Err.Number = 2501 Then
'MsgBox Err.Description
Resume Next
Else
MsgBox Err.Description
Resume Exit_Report_Click
End If
End Sub
When I clicked the button for the first time I was warned with an
ERROR 2501. I tried to catch and skip the error as the above code shows but
no way, the report doesn't export to PDF and nothing of course is saved to
defined location.
Apparently, as shown in attached capture, it seems that is it working
but nothing really happens.
If I try to export the report directly by Access (2010) menu it works fine so it doesn't seem a problem related to PDF drivers or printer.
Anyone willing to shed some light on this subject?
Thanks in advance, have a good day!
P.S.: if I posted in the wrong place, please forgive me, is my first post!
here am I with my very first question for you.
I tried investigating by myself of course in this forum as well as over the net but couldn't find any useful hint to solve the problem I bumped into.
Here is detail of what happening...
1) I have created a form with a button whose function is (would be... :banghead to export a given already created and formatted REPORT
to PDF format and save it on my desktop.
The code behind the command button is the following:
Private Sub Comando0_Click()
On Error GoTo Err_Report_Click
'DoCmd.OpenReport "REPORT_CARBURANTI_LUG-AGO_2017", acViewPreview, acWindowNormal
'DoCmd.OutputTo acOutputReport, "REPORT_CARBURANTI_LUG-AGO_2017", acFormatPDF, "C:\DESKTOP\RPT.pdf", True
DoCmd.OpenReport "AN_VEICOLI", acViewPreview, acWindowNormal
DoCmd.OutputTo acOutputReport, "AN_VEICOLI", acFormatPDF, "C:\DESKTOP\ANV.pdf", True
DoCmd.Close , , acSaveYes
'DoCmd.OutputTo acOutputReport, "REPORT_CARBURANTI_LUG-AGO_2017", acFormatPDF, "C:\DESKTOP\REPORT_CARBURANTI_LUG-AGO_2017" & Format(Date, "mmddyyyy") & ".pdf"
Exit_Report_Click:
Exit Sub
Err_Report_Click:
If Err.Number = 2501 Then
'MsgBox Err.Description
Resume Next
Else
MsgBox Err.Description
Resume Exit_Report_Click
End If
End Sub
When I clicked the button for the first time I was warned with an
ERROR 2501. I tried to catch and skip the error as the above code shows but
no way, the report doesn't export to PDF and nothing of course is saved to
defined location.
Apparently, as shown in attached capture, it seems that is it working
but nothing really happens.
If I try to export the report directly by Access (2010) menu it works fine so it doesn't seem a problem related to PDF drivers or printer.
Anyone willing to shed some light on this subject?
Thanks in advance, have a good day!
P.S.: if I posted in the wrong place, please forgive me, is my first post!