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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| 'Verification du parcours
Dim Mesparcours As New ADODB.Recordset
Dim parcourDISCORB As New ADODB.Recordset
parcourDISCORB.Open ("SELECT * from PARCOURS WHERE N°ELEVE = " & [numeleve] & " ORDER BY PLACE "), DBDISCORB, adOpenDynamic, adLockReadOnly
'si l'eleve a un parcours
If Not parcourDISCORB.EOF Then
Mesparcours.Open ("SELECT * from PARCOURS WHERE N°ELEVE = " & [nvnumeleve] & " ORDER BY PLACE "), MaDB, adOpenDynamic, adLockOptimistic, adCmdText
'Si il y a deja un parcours dans la base
If Not Mesparcours.EOF Then
j = 0
i = 0
While Not parcourDISCORB.EOF
place = parcourDISCORB.Fields("place")
Mesparcours.MoveFirst
MsgBox Mesparcours.Fields("N°eleve")
MsgBox ("place discorb = " & place)
While Not Mesparcours.EOF
If Mesparcours.Fields("place") = place And Mesparcours.Fields("modif") < parcourDISCORB.Fields("modif") Then
ann = parcourDISCORB.Fields("Annee")
eta = parcourDISCORB.Fields("etablissement")
cla = parcourDISCORB.Fields("classe")
com = parcourDISCORB.Fields("commentaire")
MsgBox ("place = " & Mesparcours.Fields("place"))
If Mesparcours.Fields("ann") <> parcourDISCORB.Fields("ann") Then
NvRqt = "update parcours set annee= #" & [ann] & "# where N°Eleve = " & [nvnumeleve] & " and place = " & [place] & " "
MaDB.Execute NvRqt, iAffected, adExecuteNoRecords
End If
If Mesparcours.Fields("etablissement") <> parcourDISCORB.Fields("etablissement") Then
NvRqt = "update parcours set etablissement = '" & [eta] & "' where N°Eleve = " & [nvnumeleve] & "and place = " & [place] & " "
MaDB.Execute NvRqt, iAffected, adExecuteNoRecords
End If
If Mesparcours.Fields("classe") <> parcourDISCORB.Fields("classe") Then
NvRqt = "update parcours set classe= " & [cla] & " where N°Eleve = " & [nvnumeleve] & "and place = " & [place] & " "
MaDB.Execute NvRqt, iAffected, adExecuteNoRecords
End If
If Mesparcours.Fields("commentaire") <> parcourDISCORB.Fields("commentaire") Then
NvRqt = "update parcours set commentaire= " & [com] & " where N°Eleve = " & [nvnumeleve] & " and place = " & [place] & ""
MaDB.Execute NvRqt, iAffected, adExecuteNoRecords
End If
Dat = Date
NvRqt = "update parcours set modif = #" & [Dat] & "# where N°Eleve= " & [nvnumeleve] & " and place = " & [place] & " "
MaDB.Execute NvRqt, iAffected, adExecuteNoRecords
End If
Mesparcours.MoveNext
i = i + 1
Wend
j = j + 1
parcourDISCORB.MoveNext
Wend
'Si il ya des parcours qui n'etaient pas rentré dans notre base
If j > i Then
parcourDISCORB.MoveLast
For k = 0 To j - i
Mesparcours.AddNew
Mesparcours.Fields("N°eleve") = nvnumeleve
Mesparcours.Fields("Annee") = parcourDISCORB.Fields("Annee")
Mesparcours.Fields("etablissement") = parcourDISCORB.Fields("etablissement")
Mesparcours.Fields("classe") = parcourDISCORB.Fields("classe")
Mesparcours.Fields("commentaire") = parcourDISCORB.Fields("commentaire")
Mesparcours.Fields("modif") = Date
Mesparcours.Fields("place") = i + 1
Mesparcours.Update
i = i + 1
Next k
End If
Mesparcours.Close
Else
While Not parcourDISCORB.EOF
Mesparcours.AddNew
Mesparcours.Fields("N°eleve") = nvnumeleve
Mesparcours.Fields("Annee") = parcourDISCORB.Fields("Annee")
Mesparcours.Fields("etablissement") = parcourDISCORB.Fields("etablissement")
Mesparcours.Fields("classe") = parcourDISCORB.Fields("classe")
Mesparcours.Fields("commentaire") = parcourDISCORB.Fields("commentaire")
Mesparcours.Fields("modif") = Date
Mesparcours.Fields("place") = parcourDISCORB.Fields("place")
Mesparcours.Update
parcourDISCORB.MoveNext
Wend
Mesparcours.Close
End If
End If
parcourDISCORB.Close |
Partager