:banghead: I've made the decision to use the database to create invoices. I have it set up to create the invoice upon clicking, once the invoice is created it saves automatically to my desktop and the creates an email in outlook with the pdf attached. However, I keeping getting the dreaded 2501 error. It will create the record in the database, but not the pdf or the email. The frustrating part is it happens intermittently. I can create 10 invoices with no issues, and then the next 10 will give me the error message every other invoice. I can't seem to find any logical reasoning behind it. Any help would be greatly, greatly appreciated.
'Open the Report Filtering by the WHERE Clause for specific [InitiativeID] Value
DoCmd.OpenReport strRptName, acViewPreview, , "[MbrshipDuesID]=" & DMax("MbrshipDuesID", "[Membership Dues Tracking]", "[CompanyID]=" & Me.CompanyID)
Reports(strRptName).Caption = strReportCaption
'save report to desktop folder
Dim strFile As String
Dim strFile2 As String
strFile = Environ("USERPROFILE") & "\Desktop\DuesInvoices\" & strReportCaption & ".pdf"
strFile2 = Environ("USERPROFILE") & "\Desktop\DuesInvoices\ABC COMPANY Payment Form.pdf"
DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF, strFile, False
'Open the Report Filtering by the WHERE Clause for specific [InitiativeID] Value
DoCmd.OpenReport strRptName, acViewPreview, , "[MbrshipDuesID]=" & DMax("MbrshipDuesID", "[Membership Dues Tracking]", "[CompanyID]=" & Me.CompanyID)
Reports(strRptName).Caption = strReportCaption
'save report to desktop folder
Dim strFile As String
Dim strFile2 As String
strFile = Environ("USERPROFILE") & "\Desktop\DuesInvoices\" & strReportCaption & ".pdf"
strFile2 = Environ("USERPROFILE") & "\Desktop\DuesInvoices\ABC COMPANY Payment Form.pdf"
DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF, strFile, False