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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Sub EmettreDeplacementExemple()
Dim erreur
Dim idfamille As String
Dim oRst As dao.Recordset
Dim oDb As dao.Database
Dim oRstAnnee As dao.Recordset
Dim oRstReqIndemniteFamille As dao.Recordset
Dim oAnnee As String
Dim sNomSousRepertoire As String
Dim sNomFichierInitial As String
Dim sNomRepertoire As String
Dim sNomFichier As String
Dim oRstRepertoire As dao.Recordset
Dim s As String
Dim dSoldeChauffeur As Double
Dim dSoldePassager As Double
Dim dSolde As Double
Dim dChauffeur As Double
Dim dPassager As Double
Dim oRstFichier As dao.Recordset
Set oDb = CurrentDb
Set oRstReqIndemniteFamille = oDb.OpenRecordset("reqindemnitefamille", dbOpenDynaset)
If Not oRstReqIndemniteFamille.EOF And Not oRstReqIndemniteFamille.BOF Then
Do Until oRstReqIndemniteFamille.EOF
idfamille = oRstReqIndemniteFamille.Fields("idfamille")
sNomFichier = "facture_PECHE_79.pdf"
sNomRepertoire = "E:\Users\gilbert\marchipontain\2023-2024\facture"
Debug.Print "idfamille = " & idfamille
' DoCmd.SetParameter "idFamille", idfamille
'HAVING (((reqindemniterecap.idfamille)=8))
' DoCmd.OpenReport "etatfactures", acViewNormal, , "[reqindemniterecap]![idfamille]= " & oRstReqIndemniteFamille.Fields("idfamille"), acDialog
' DoCmd.
DoCmd.OpenReport "etatfactures", acViewPreview, , "[numerofamille]= " & oRstReqIndemniteFamille.Fields("idfamille"), acDialog
'DoCmd.OpenReport "etatfactures", acViewPreview, , "", acWindowNormal
DoCmd.OutputTo acOutputReport, "etatfactures", acFormatPDF, sNomRepertoire & "\" & Trim(sNomFichier) & ".pdf"
'DoCmd.save acOutputReport, "etatfactures", acFormatPDF, sNomRepertoire & "\" & Trim(sNomFichier) & ".pdf"
DoCmd.Close acOutputReport, "etatfactures", acSaveNo
oRstReqIndemniteFamille.MoveNext
Loop
oRstReqIndemniteFamille.Close
Set oRstReqIndemniteFamille = Nothing
End If
oDb.Close
Set oDb = Nothing
End Sub |
Partager