1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Option Compare Database
Option Explicit
Public Sub CotiDues(NumDebut As Integer)
Dim sSql As String
Dim q As QueryDef
sSql = "SELECT [T Adhérents].N°Adherent, [T Adhérents].Nom, [T Adhérents].Prenom, " _
& "[Du" & Format(NumDebut, "00") & "]+[Du" & Format(NumDebut + 1, "00") & "]" _
& "+[Du" & Format(NumDebut + 2, "00") & "]+[Du" & Format(NumDebut + 3, "00") & "]" _
& "+[Du" & Format(NumDebut + 4, "00") & "]+[Du" & Format(NumDebut + 5, "00") & "]" _
& " AS [Total dû], [T Cotisations dues].Du" & Format(NumDebut, "00") & "," _
& "[T Cotisations dues].Du" & Format(NumDebut + 1, "00") & "," _
& "[T Cotisations dues].Du" & Format(NumDebut + 2, "00") & "," _
& "[T Cotisations dues].Du" & Format(NumDebut + 3, "00") & "," _
& "[T Cotisations dues].Du" & Format(NumDebut + 4, "00") & "," _
& "[T Cotisations dues].Du" & Format(NumDebut + 5, "00") _
& " FROM ([T Adhérents] INNER JOIN [T Cotisations] " _
& " ON [T Adhérents].N°Adherent = [T Cotisations].N°Adherent) " _
& " INNER JOIN [T Cotisations dues] ON [T Adhérents].N°Adherent = [T Cotisations dues].N°Adherent " _
& " WHERE ((([T Adhérents].Adherent) = True)) ORDER BY [T Adhérents].Nom, [T Adhérents].Prenom;"
Set q = CurrentDb.QueryDefs("rCotiDues")
q.SQL = sSql
End Sub |
Partager