I have the following code which works fine on my machine which has SP2 and SP3 (Office 2007) installed.
However, another user is getting the error "Runtime error 2501-The open report was cancelled" when trying to run any reports.
Do they need SP3 installed as well as SP2. They have SP2 installed
It is breaking on the line DoCmd... for each report.
Report location value on their machine is "D:\Reports". I have checked that the folder exists and they have write access to it.
However, another user is getting the error "Runtime error 2501-The open report was cancelled" when trying to run any reports.
Do they need SP3 installed as well as SP2. They have SP2 installed
Code:
Private Sub btnSubmit_Click()
On Error GoTo Err_handler
Dim ReportLocation As String
Dim strLocation As String
ReportLocation = DMax("ReportLocation", "tblReportLocation")
strLocation = ReportLocation
If IsNull(Me.cboReports) Then
MsgBox "You must select a report"
Else
If Me.cboReports = 1 Then
DoCmd.OutputTo acOutputReport, "rptProspecttoClientForecast", acFormatPDF, strLocation & "ProspecttoClientForecastReport.pdf", True
Else
If Me.cboReports = 2 Then
DoCmd.OutputTo acOutputReport, "rptLengthofAcquisition", acFormatPDF, strLocation & "LengthofAcquisitionReport.pdf", True
Else
If Me.cboReports = 3 Then
DoCmd.OutputTo acOutputReport, "rptNumberofMeetings", acFormatPDF, strLocation & "NumberofMeetings.pdf", True
Else
If Me.cboReports = 4 Then
DoCmd.OutputTo acOutputReport, "rptCategoriesSignedatLOE", acFormatPDF, strLocation & "CategoriesSignedatLOE.pdf", True
Else
If Me.cboReports = 5 Then
DoCmd.OutputTo acOutputReport, "rptCategoriesSignedRecReport", acFormatPDF, strLocation & "CategoriesSignedRecReport.pdf", True
Else
If Me.cboReports = 6 Then
DoCmd.OutputTo acOutputReport, "rptLengthofDelivery", acFormatPDF, strLocation & "LengthofDelivery.pdf", True
End If
End If
End If
End If
End If
End If
End If
Endit:
Exit Sub
Err_handler:
If Err = 2501 Then
Resume Endit
Else
MsgBox _
"An unexpected error has been detected" & Chr(13) & _
"Description is: " & Err.Number & ", " & Err.Description & Chr(13) & _
"Module is: commandbutton_click" & Chr(13) & _
"Please note the above details before contacting support"
Resume Endit
End If
Exit Sub
End Sub
It is breaking on the line DoCmd... for each report.
Report location value on their machine is "D:\Reports". I have checked that the folder exists and they have write access to it.