Expected = (1 Viewer)

John Sh

Member
Local time
Tomorrow, 05:56
Joined
Feb 8, 2021
Messages
410
In the calling sub, printIt(), the line " doReport(me.name, "PDF", "Bay", True)" returns an error, "Expected =".
I have tried renaming both subs, but continue to get the same error.
The sub printIT() will reside in various forms that control reports.
The sub doReports() is in a module and controls the output of the reports, either view or save PDF or print to paper.
nReportNum is a global variable of type integer.

As an aside, if I replace "pathRep" with "TempVars!patha & "reports\"" in docmd.outputTo, the PDF file is viewed, but not saved.

Code:
Private Sub printIt()
    doReport(me.name, "PDF", "Bay", True)
End Sub


Public Sub doReport(sReport As String, sFormat As String, sTitle As String, bView As Boolean)
    Dim pathRep As String
    If sFormat = "Print" Then
        Dim myNewPrinter As Printer
        Set myNewPrinter = Application.Printers(Application.Printer.DeviceName)
        DoCmd.OpenReport sReport
    Else
        pathRep = TempVars!patha & "reports\"
        sFormat = "acformat" & sFormat
        DoCmd.OutputTo acOutputReport, sReport, sFormat, pathRep & sTitle & nReportNum & ".pdf", bView
    End If
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:56
Joined
May 7, 2009
Messages
19,247
either use:

Call doReport(me.name, "PDF", "Bay", True)

or

doReport me.name, "PDF", "Bay", True
 

Users who are viewing this thread

Top Bottom