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
|
Private Sub BtnEnregisterElevesComposants_Click()
Dim stMsg As String
Dim Itm As Variant
Dim oDb As Database
Dim oRS As Recordset
With Me.ListeELEVES_ANNEE_CLASSE
' contrôle saisie élèves
If .ItemsSelected.Count = 0 Then Exit Sub
' contrôle saisie Classe
If IsNull(Me.lstClasse_Evaluation) Then
MsgBox "Sélectionnez une classe.", vbCritical
Me.lstClasse_Evaluation.SetFocus
'Me.lstClasse_Evaluation.Dropdown **** Pour dérouler le combobox à l'aide de la méthode DROPDOWN
SendKeys "{F4}" '*** Pour dérouler le combobox à l'aide de l'envoi de touche clavier (F4)
Exit Sub
End If
stMsg = "Voulez-vous insérer les élèves suivants:" & vbCrLf
For Each Itm In .ItemsSelected
stMsg = stMsg & .Column(4, Itm) & vbCrLf
Next Itm
' Confirmer l'insertion des élèves
stMsg = stMsg & "?"
If MsgBox(stMsg, vbQuestion + vbYesNo) = vbNo Then Exit Sub
Set oDb = CurrentDb
Set oRS = oDb.OpenRecordset("Tbl_EVALUATION_NIVEAU_SCOLAIRE", dbOpenDynaset)
'________________________________________________________________________
'Ici; appel de la fonction de gestion de doublons.
'Cette fonction devrait empêcher toutes les informations déjà enregistrées dans la table "Tbl_EVALUATION_NIVEAU_SCOLAIRE" d'y être insérées une nouvelle fois pour une composition.
'________________________________________________________________________
If fEstEleveDejaComposant(Me.ID_ETABL_FREQ, Me.NumInscriptionEleveInscrit, Me.Mleeleve, Me.ANNEE_SCOL, Me.ListeComposition_Evaluation, Me.ListeNiveauEVALUATION) = True Then
MsgBox "ATTENTION !!" & vbCrLf & "Cet élève est déjà enregistré pour cette: " & Me.ListeComposition_Evaluation.Column(1), vbCritical + vbOKOnly, "Risque de Doublons"
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!NumEnregistreComposant = ""
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!IdEcole = ""
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!AnneeScol = ""
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!COMPOSITION = ""
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!NumInsCreleve = ""
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!Mleeleve = ""
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!Nom_Prenoms_EleveComposant = ""
Me.Tbl_EVALUATION_NIVEAU_SCOLAIRE_SFrm.Form!NiveauCompositionFrancais = ""
End If
'____________________________________________________________________
'_____________________________________________________________________
' ajout des éléments sélectionnés
For Each Itm In .ItemsSelected
oRS.AddNew
oRS.Fields("NumEnregistreComposant") = f_NumAutoEnregistrementElevesComposants() + 1 '.Column(0, Itm)
oRS.Fields("Nom_Prenoms_EleveComposant") = .Column(4, Itm)
oRS.Fields("COMPOSITION") = Me.ListeComposition_Evaluation '.Column(2, Itm)
oRS.Fields("NiveauCompositionFrancais") = Me.ListeNiveauEVALUATION '.Column(2, Itm)
oRS.Fields("IdEcole") = Me.ID_ETABL_FREQ '.Column(9, Itm)
oRS.Fields("AnneeScol") = Me.ANNEE_SCOL '.Column(8, Itm)
oRS.Fields("NumInsCreleve") = .Column(2, Itm)
oRS.Fields("MleEleve") = .Column(3, Itm)
oRS.Update
Next Itm
' enlever la sélection
.RowSource = .RowSource
' affichage des éléments saisis
Me.Refresh
Me.ListeELEVES_ANNEE_CLASSE.Requery
End With
End Sub |
Partager