trying to add form date field to report .snp file name on export?

B

Brook

Good Day,

I have a rptinvoice that I export to .snp format and right now I have field
invoicenumber added to the report name (see code below), but I would to also
add the invoicedate to the report name, but am getting a runtime error 2024.

Can anyone help me?

Begin Code:
Private Sub cmdprintinvoice_Click()
Dim strReportName As String
Dim strcriteria As String

If NewRecord Then
MsgBox "This record contains no data. Please select a record to
print or Save this record." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "rptinvoices"
strcriteria = "[invoiceid]= " & Me![invoiceid]


DoCmd.OpenReport strReportName, acViewPreview, , strcriteria


If MsgBox("Do you want to save the report to disk?", vbYesNo +
vbQuestion, "Save Report") = vbYes Then

strOutputName = "D:\Karma Imports\Invoices\" & (Me!invoicenumber) &
" - " & Format(Date, "mm_dd_yyyy") & ".snp"



DoCmd.OutputTo acOutputReport, strReportName, acFormatSNP,
strOutputName, True
End If


End If
End Sub

End Code

Thanks,

Brook
 
S

Steve Schapel

Brook,

I am not sure of the precise limitation you are coming up against here,
but all I can suggest is you experiment with simplifying the file name
you are trying to use... reduce its overall length, remove spaces,
remove the -, etc. I would try it first like this, and see if you still
get the error...
strOutputName = "D:\Karma Imports\Invoices\" & Me!invoicenumber & "_"
& Format(Date, "mmddyy") & ".snp"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top