My Outputto method was canceled

LWANZO MUMBERE 0 Reputation points
2023-06-17T20:14:05.0333333+00:00

A chaque fois j'essai d'exporter ma facture au format PDF, il y a retour du message ( Outputto est annulé) voilà j'ai le souci d'activé cette methode.


Public Sub ExporterPDF(reportName As String, Critere As String)
Dim dossier, fichier As String
Dim CodeFacture As String
Dim client As String
Dim idClient As Integer

CodeFacture = DLookup("CodeFacture", "Commandes", Critere)
idClient = DLookup("idClient", "Commandes", Critere)
client = DLookup("NomComplet", "Clients", "idClient=" & idClient)

dossier = CurrentProject.path & "\G.Stock\" & IIf(reportName = "E_Facture", "Facture\", "BL\")
fichier = IIf(reportName = "E_Facture", "", "BL") & Replace(CodeFacture, "/", "_") & " " & UCase(client) & ".pdf"

DoCmd.OpenReport reportName, acViewPreview, , Critere, acHidden
DoCmd.OutputTo acOutputReport, reportName, acFormatPDF, dossier & fichier
DoCmd.Close acReport, reportName, acSaveNo

Dim db As Database
Set db = CurrentDb
Dim req As String
req = " Update Commandes SET " & IIf(reportName = "E_Facture", "UrlFacture", "UrlBL") & " = '" & dossier & fichier & "'" & _
      " WHERE CodeFacture='" & CodeFacture & "'"
db.Execute req
db.Close
Set db = Nothing

End Sub
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.