I have a working database on my computer that lets me add expense items, employees, work entries, etc., then output into reports (e.g. Employee Expense Report). Everything works fine on my computer, but when my friend tries to run reports on his Surface Pro, he gets a Runtime error 2501. Here is an example of the code generating the error:
Code Tags Added by UG
	
	
	
		
The line that appears to be causing the problem is:
DoCmd.OutputTo acOutputReport, "Employee Expense Report", acFormatPDF, strFolder & "\" & sFilename, False
The error occurs after he selects the folder to put the report in. Seems strange that the reports run just fine for me. Any ideas? I'm an Access noob.
 Code Tags Added by UG
		Code:
	
	
	Private Sub EmpExpDown_Click()
    Dim fd As FileDialog
    Dim strFolder As String
    Dim sFilename As String
    sFilename = [EmployeeEntered] & " Expenses " & [EmpStartDate] & ".pdf"
    Set fd = Application.FileDialog(msoFileDialogFolderPicker)
    If fd.Show = -1 Then
    strFolder = fd.SelectedItems.Item(1)
    Else
    Exit Sub
    End If
  
    DoCmd.OutputTo acOutputReport, "Employee Expense Report", acFormatPDF, strFolder & "\" & sFilename, False
    Set fd = Nothing
End Sub
	The line that appears to be causing the problem is:
DoCmd.OutputTo acOutputReport, "Employee Expense Report", acFormatPDF, strFolder & "\" & sFilename, False
The error occurs after he selects the folder to put the report in. Seems strange that the reports run just fine for me. Any ideas? I'm an Access noob.
			
				Last edited by a moderator: