Run-Timer Error: "2302" on report generation

B

Brook

Hello All,

I am getting this error when I am trying to OutPutto my report:

Microsoft Office Access can't save the output data to the file you've
selected.

here is my command button code:

Begin Code:

Private Sub cmdPrintPreview_Click()

Dim strReportName As String
Dim strCriteria As String
Dim strOutputName 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 = "rptcustomorders"
strCriteria = "[orderid]= " & Me![orderid]

DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

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

strOutputName = DLookup("[OrdNum]", "qryinventory") & " - " &
Format(Date, "dd/mm/yyyy")

DoCmd.OutputTo acOutputReport, strReportName, "Rich Text Format",
strOutputName, True
End If

End If
End Sub

End Code


I'm Baffled... don't know where else to look..

Thanks in advance..

Brook
 

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