1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Private Sub BtnEnvListePDF_Click()
Dim strNomDocument As String
Dim NumMailActif As String
strNomDocument = "Liste RDV " & Screen.ActiveForm.NumContact
'Ouvre l' état
DoCmd.OpenReport ("rptlisteactions"), acViewPreview, , "[numgrpaction]=screen.activeform.numgrpaction"
'Enregistre l'état
DoCmd.OutputTo acOutputReport, , "PDF", strNomDocument
DoCmd.Close
DoCmd.OpenForm ("mails"), , , , acFormAdd
With Forms("mails")
.CboContact = Me.NumContact
.Objet = "Votre facture Click and Go ! informatique"
.Salutations = DLookup("entêtecourrier", "contacts", "[numcontact]='" & Screen.ActiveForm.[NumContact] & "'")
.Destinataires = DLookup("mail1", "contacts", "[numcontact]='" & Screen.ActiveForm.[NumContact] & "'")
.Signature = DLookup("signaturepardéfaut", "entreprise")
End With
NumMailActif = Forms("mails")![NumMail]
'Enregistre l'état en tant que pièce jointe dans le mail en édition
DoCmd.SetWarnings False
DoCmd.RunSQL "insert into [attachments mails](nummail,pathattachment) values ( '" & NumMailActif & "','" & strNomDocument & "');"
DoCmd.SetWarnings True
End Sub |
Partager