Hi all,
My access program printing the reports in pdf on local drive well. But when computer on network then some time it saves the pdf on desktop but most of the time the error occurs which is 2501.
Can any body suggest or having experience of similar problem and handled it?
My access program printing the reports in pdf on local drive well. But when computer on network then some time it saves the pdf on desktop but most of the time the error occurs which is 2501.
Code:
Private Sub cmdPrint_Click()
Me.Form.Refresh
' my code
DoCmd.SetWarnings False
Dim strUserName As String
Dim strPath As String
Dim strDate As Date
Dim db_report_name As String
Dim strFileName As String
Me.cboSearch.SetFocus
If (IsNull(Me.cboSearch.Text) Or Me.cboSearch.Text = "") Then
' MsgBox "Please select EMP ID from drop down", vbInformation, "Tool Admin"
DoCmd.OpenForm "frmMessage"
Form_frmMessage.lblMessage.Caption = "EMP ID is missing ! Please select EMP ID from drop down"
Exit Sub
End If
db_report_name = DLookup("fldReportName", "tbl_ReportNames", "Full_Name = '" & Me.cmbAllReports.value & "'")
db_report_name = Replace(db_report_name, " ", "")
strFileName = Me.EmpID & "_" & Me.FirstName & "_" & Me.cmbAllReports
'strFileName = "Consent Form"
strUserName = Environ("username")
If Len(strFileName) = 0 Then
Else
strPath = "C:\Users\" & strUserName & "\desktop\rpts\" & strFileName & " .pdf"
'DoCmd.OpenReport "rptConsentForm", acViewPreview
DoCmd.OutputTo acOutputReport, db_report_name, acFormatPDF, strPath, False
End If
'my code end
DoCmd.SetWarnings True
End Sub
Can any body suggest or having experience of similar problem and handled it?