1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| 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") & "]" _
& " AS [Total dû], [TCotisationsdues].Du" & Format(NumDebut, "00") & "," _
& "[TCotisationsdues].Du" & Format(NumDebut + 1, "00") & "," _
& "[TCotisationsdues].Du" & Format(NumDebut + 2, "00") & "," _
& "[TCotisationsdues].Du" & Format(NumDebut + 3, "00") & "," _
& "[TCotisationsdues].Du" & Format(NumDebut + 4, "00") _
& " FROM ([T Adhérents] INNER JOIN [TCotisations] " _
& " ON [T Adhérents].N°Adherent = [TCotisations].N°Adherent) " _
& " INNER JOIN [TCotisationsdues] ON [T Adhérents].N°Adherent = [TCotisationsdues].N°Adherent " _
& " WHERE ((([T Adhérents].Adherent) = True)) ORDER BY [T Adhérents].Nom, [T Adhérents].Prenom;"
Set q = CurrentDb.QueryDefs("R CotiDues")
q.SQL = sSql
End Sub |
Partager