Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Sacramento, CA
    Thanked 1 Time in 1 Post
    I have a BE database in which the client can choose from 1 to about 30 reports to be output to pdf's or a printer. Generally the code works as anticipated, looping trough each and printing each selected report. Depending on the number of reports selected and the amount of data, the reporting can take considerable time to complete. If the pdf option has been selected for the reports and the client attempts to do anything else (e.g. check email or open another application) during the reporting, a 2046 "OutputTo is not available" error is generated. This error is also generated should another process be started automatically (e.g. software updates).

    Looking for any thoughts on why this happens and some ideas on preventing the Error. Below is the function which is called from within the loop to output the reports. If the printer option has been selected rather than pdf, the user can perform other actions outside Access with no problems while code is running. I've triple checked the reports and all variables being passed and there are no problems or issues.

    Function PrintReport( _
    pPrintOpt As Integer, _
    pRptName As String, _
    pOutPutTo As String _
    ) As Boolean
    On Error GoTo Err_PrintReport

    If pPrintOpt = 1 Then
    gfFinalPrint = True
    DoCmd.OpenReport _
    pRptName, _
    acNormal, , , _
    acWindowNormal, _
    DoCmd.OutputTo _
    acOutputReport, _
    pRptName, _
    acFormatPDF, _
    pOutPutTo, _
    End If

    PrintReport = True

    Exit Function
    If Err <> 2501 Then
    MsgBox CStr(Err) & ": " & Err.Description, _
    vbOKOnly + vbCritical, _
    End If
    PrintReport = False
    Resume Exit_PrintReport
    End Function

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts
    Try using a third-party printer (Adobe Acrobat, PDF995, CutePDF, ...), or Stephen Lebans' ReportToPDF instead of the built-in feature.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts