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
|
Function ExtraireInfo_ori(Frm)
Dim Sql As String, S As String, DS As String
If IsNull(Frm!DateSaisie) Then Frm!DateSaisie = ""
If Frm!DateSaisie <> "" Then
DS = Format(Frm!DateSaisie, "DD/MM/YYYY")
S = "S_" & Str(Day(DS))
S = Trim(S)
Sql = "SELECT Travailleurs.NomPrenom, Activites.Activite, Travailleurs.Tel, Travailleurs.Portable,"
Sql = Sql & " Travailleurs.Tutelle, Travailleurs.Curatelle, Travailleurs.TelTC As [Tél],"
Sql = Sql & " Travailleurs.CiviliteTC, Activites.NumeroActivite"
Sql = Sql & " FROM Travailleurs INNER JOIN"
Sql = Sql & " SituationsMensuelles ON Travailleurs.Numero = SituationsMensuelles.NumeroTravailleur INNER JOIN"
Sql = Sql & " Activites ON Travailleurs.NumeroActivite = Activites.NumeroActivite"
Sql = Sql & " WHERE Travailleurs.QuitterCAT = 0 AND SituationsMensuelles.Mois = " & Month(DS)
Sql = Sql & " AND SituationsMensuelles.Annee = " & Year(DS)
Sql = Sql & " AND (SituationsMensuelles." & S & "=0 OR SituationsMensuelles." & S & "= 5 OR SituationsMensuelles." & S & "= 12)"
Sql = Sql & " UNION "
Sql = Sql & " SELECT T1.NomPrenom, Activites.Activite, T1.Tel, T1.Portable, T1.Tutelle, T1.Curatelle,"
Sql = Sql & " T1.TelTC, T1.CiviliteTC, Activites.NumeroActivite"
Sql = Sql & " FROM Travailleurs T1 INNER JOIN"
Sql = Sql & " Activites ON T1.NumeroActivite = Activites.NumeroActivite"
Sql = Sql & " WHERE (NOT EXISTS"
Sql = Sql & " (SELECT SM.NumeroTravailleur"
Sql = Sql & " FROM SituationsMensuelles AS SM INNER JOIN"
Sql = Sql & " Travailleurs ON SM.NumeroTravailleur = T1.Numero"
Sql = Sql & " WHERE (Annee = " & Year(DS) & " AND Mois = " & Month(DS) & ")) AND T1.QuitterCAT = 0)"
Sql = Sql & " Order By Activites.Activite, Travailleurs.NomPrenom"
Frm!ListeAbsents.RowSource = Sql
Frm!ListeAbsents.Requery
End If
End Function |
Partager