Bonsoir
J'ai besoin d'aide pour finaliser mon application paroissiale. En testant mon application, j'ai oublié la question des doublons. Je souhaite qu'une personne soit enregistrée un seule fois et tenant compte de son nom prénoms et date de naissance. Si je saisie un nom et prénoms existant il doit avoir un message me disant " catéchumène déjà enregistré".
Code original du bouton ajouter userform0
et code original modifié pour la circonstance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Sub CommandButton4_Click() If ComboBox1.Value = "" Then MsgBox "Veuillez renseigner le champs 'Nom & Prénoms' ", , "Saisie Obligatoire" Me.ComboBox1.SetFocus Exit Sub End If If Me.Textbox1.Value = "" Then MsgBox "Vous devez entrer une date de naissance .", , "Saisie Obligatoire" Me.Textbox1.SetFocus Exit Sub End If If Me.ComboBox2.Value = "" Then MsgBox "Veuillez choisir une Section.", , "Saisie Obligatoire" Me.ComboBox2.SetFocus Exit Sub End If If Me.ComboBox3.Value = "" Then MsgBox "Veuillez choisir un Niveau.", , "Saisie Obligatoire" Me.ComboBox2.SetFocus Exit Sub End If If Me.TextBox3.Value = "" Then MsgBox "Veuillez saisir le nom du quartier.", , "Saisie Obligatoire" Me.TextBox3.SetFocus Exit Sub End If If Me.TextBox6.Value = "" Then MsgBox "Veuillez saisir au moins un contact.", , "Saisie Obligatoire" Me.TextBox6.SetFocus Exit Sub End If If Me.TextBox7.Value = "" Then MsgBox "Veuillez saisir le nom du Père.", , "Saisie Obligatoire" Me.TextBox7.SetFocus Exit Sub End If If Me.TextBox8.Value = "" Then MsgBox "Veuillez saisir le nom de la Mère .", , "Saisie Obligatoire" Me.TextBox8.SetFocus Exit Sub End If Dim ligne As Integer If MsgBox("confirmez-vous l'ajout des données?", vbYesNo, "confirmation") = vbYes Then Worksheets("BD_CENTRALISEE").Select ligne = Sheets("BD_CENTRALISEE").Range("A2000").End(xlUp).Row + 1 Cells(ligne, 1) = TextBox11.Value Cells(ligne, 2) = ComboBox1.Value Cells(ligne, 3) = Textbox1.Value Cells(ligne, 4) = TextBox2.Value Cells(ligne, 5) = ComboBox2.Value Cells(ligne, 6) = ComboBox3.Value Cells(ligne, 7) = TextBox5.Value Cells(ligne, 8) = TextBox3.Value Cells(ligne, 9) = TextBox4.Value Cells(ligne, 10) = TextBox6.Value Cells(ligne, 11) = TextBox7.Value Cells(ligne, 12) = TextBox8.Value Cells(ligne, 13) = TextBox9.Value CommandButton11_Click Init Unload UserForm0 UserForm0.Show Else End If End Sub
Mais ça ne marche pas. Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Sub CommandButton4_Click() If ComboBox1.Value = "" Then MsgBox "Veuillez renseigner le champs 'Nom & Prénoms' ", , "Saisie Obligatoire" Me.ComboBox1.SetFocus Exit Sub End If If Me.Textbox1.Value = "" Then MsgBox "Vous devez entrer une date de naissance .", , "Saisie Obligatoire" Me.Textbox1.SetFocus Exit Sub End If If Me.ComboBox2.Value = "" Then MsgBox "Veuillez choisir une Section.", , "Saisie Obligatoire" Me.ComboBox2.SetFocus Exit Sub End If If Me.ComboBox3.Value = "" Then MsgBox "Veuillez choisir un Niveau.", , "Saisie Obligatoire" Me.ComboBox2.SetFocus Exit Sub End If If Me.TextBox3.Value = "" Then MsgBox "Veuillez saisir le nom du quartier.", , "Saisie Obligatoire" Me.TextBox3.SetFocus Exit Sub End If If Me.TextBox6.Value = "" Then MsgBox "Veuillez saisir au moins un contact.", , "Saisie Obligatoire" Me.TextBox6.SetFocus Exit Sub End If If Me.TextBox7.Value = "" Then MsgBox "Veuillez saisir le nom du Père.", , "Saisie Obligatoire" Me.TextBox7.SetFocus Exit Sub End If If Me.TextBox8.Value = "" Then MsgBox "Veuillez saisir le nom de la Mère .", , "Saisie Obligatoire" Me.TextBox8.SetFocus Exit Sub End If Dim ligne As Integer If MsgBox("confirmez-vous l'ajout des données?", vbYesNo, "confirmation") = vbYes Then Worksheets("BD_CENTRALISEE").Select ligne = Sheets("BD_CENTRALISEE").Range("A2000").End(xlUp).Row + 1 Cells(ligne, 1) = TextBox11.Value Cells(ligne, 2) = ComboBox1.Value Cells(ligne, 3) = Textbox1.Value Cells(ligne, 4) = TextBox2.Value Cells(ligne, 5) = ComboBox2.Value Cells(ligne, 6) = ComboBox3.Value Cells(ligne, 7) = TextBox5.Value Cells(ligne, 8) = TextBox3.Value Cells(ligne, 9) = TextBox4.Value Cells(ligne, 10) = TextBox6.Value Cells(ligne, 11) = TextBox7.Value Cells(ligne, 12) = TextBox8.Value Cells(ligne, 13) = TextBox9.Value Else modif = MsgBox("Ce Catéchumène est déjà enregistré dans la base" & Chr(10) & Chr(10)) ' On remplace la somme et le commentaire If modif = vbYes Then Cells(ligne, 2) = Me.ComboBox1.Value Exit Sub End If If modif = vbNo Then Exit Sub End If CommandButton11_Click Init Unload UserForm0 UserForm0.Show End If End Sub
Partager