79481093

Date: 2025-03-03 13:36:36
Score: 0.5
Natty:
Report link

thanks for your response.

this is my vba code: `

Public Function Print_Order(OrderNumber As String) As Boolean
On Error GoTo ErrorHandler
''' Déclaration des variables
Dim blnReturn As Boolean
Dim rpt As AccpacCOMAPI.AccpacReport
Dim rptPrintSetup As AccpacCOMAPI.AccpacPrintSetup
blnReturn = True
''' Sélection du rapport des commandes
gstrDocumentReportName = "OECONF01[\\CANS13\ACCDATA\CUSTOM\OE64A\ENG\AGCONF03.RPT]"
Set rpt = ReportSelect(gstrDocumentReportName, " ", " ")
Set rptPrintSetup = GetPrintSetup(" ", " ")
''' Configuration de l'imprimante
rptPrintSetup.DeviceName = "Microsoft XPS Document Writer"
rptPrintSetup.OutputName = "PORTPROMPT:"
rptPrintSetup.Orientation = 1
rptPrintSetup.PaperSize = 1
rptPrintSetup.PaperSource = 15
rpt.PrinterSetup rptPrintSetup
''' Paramétrage du rapport avec le numéro de commande
rpt.SetParam "PRINTED", "1"
rpt.SetParam "DELMETHOD", "1"
rpt.SetParam "SORTFROM", OrderNumber
rpt.SetParam "SORTTO", OrderNumber
rpt.SetParam "@SELECTION_CRITERIA", "(({OEORDH.ORDERNUMBER} >= """ & OrderNumber & """) AND ({OEORDH.ORDERNUMBER} <= """ & OrderNumber & """))"
''' Aperçu du rapport des commandes
rpt.NumOfCopies = 1
rpt.Destination = PD_PREVIEW
rpt.PrintReport
Exit_Point:
On Error Resume Next
Print_Order = blnReturn
Set rpt = Nothing
Set rptPrintSetup = Nothing
Exit Function
ErrorHandler:
blnReturn = False
Resume Exit_Point
End Function

`

The code stops at the instruction in red (apparently, it does not recognize ReportSelect)

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: waiil