1 pièce(s) jointe(s)
Est-ce un bug ou un erreur dans un userform ?
Bonjour a vous,
J'ai fais un userform avec compteur afin d'avisé l'utilisateur qu'il y a des champs manquant qu'il aurais dû remplir. Lorsqu'un champs est vide, on augmente de 1 le compteur. Si le compteur est a 0, on exécute le code si le compteur est plus grand que 1, on ouvre un msgbox en avisant le nombre de champs a remplir
J'ai un probleme avec les boutons options. J'ai dans un cadre, 2 boutons options, 1 pour oui et 1 pour non.
Si j'exécute mon code sans avoir coché un des deux options, mon code compte 1 et tout va sur des roulettes. Si je coche le non, le code ne le compte pas et tous fonctionne a merveille. Si je selectionne le oui, il le compte malgré dû fait qu'il ne devrais pas ajouté.
voici le code en question
Code:
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
| Private Sub cmdOK_Click()
Dim compteur As Integer
[nom_dossier] = txtNom_dossier
[numero_dossier] = txtNumero
[nom_precedent] = textNom_anterieur
[date_demarrage] = DTPDate_rencontre
[nom_conseiller] = cmbNom_conseiller
[nom_technicien] = cmbNom_tech
[nom_chef] = cmbNom_chef
[type_de_dossier] = cmbType_dossier
[porte_du_dossier] = cmbPortee
If optOui = True Then
[premiere_fois] = "OUI"
ElseIf optNon = True Then
[premiere_fois] = "NON"
End If
If txtNom_dossier = Empty Then
compteur = compteur + 1
End If
If txtNumero = Empty Then
compteur = compteur + 1
End If
If textNom_anterieur = Empty Then
compteur = compteur + 1
End If
If DTPDate_rencontre = Empty Then
compteur = compteur + 1
End If
If cmbNom_conseiller = Empty Then
compteur = compteur + 1
End If
If cmbNom_tech = Empty Then
compteur = compteur + 1
End If
If cmbNom_chef = Empty Then
compteur = compteur + 1
End If
If cmbType_dossier = Empty Then
compteur = compteur + 1
End If
If cmbPortee = Empty Then
compteur = compteur + 1
End If
If optOui And optNon = False Then
compteur = compteur + 1
End If
If compteur > 1 Then
MsgBox "Il manque" & Chr(32) & compteur & Chr(32) & "champ(s) a remplir", vbCritical
Else
Unload Me
End If
End Sub |
Pièce jointe 420066
merci pour votre aide !!!!!