Pb block if without if

thomassc Messages postés 16 Date d'inscription mardi 27 juillet 2010 Statut Membre Dernière intervention 20 avril 2011 - 13 août 2010 à 17:37
cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 - 13 août 2010 à 17:52
Bonjour, j'ai un souci avec ce bout de code caché derriere un bouton. A l'exécution il m'envoi un messsageg d'erreur "block if without end if",
pouvez vous m'aider svp ?

Private Sub verifier_Click()

' vérifie si la date et (<=) et renvoi "Alarm !"
If (List2.List(0) <= Date) Then
A1.Caption = "Alarm !"
If (List2.List(1) <= Date) Then
A2.Caption = "Alarm !"
If List2.List(2) = Date Then
A3.Caption = "Alarm !"
If List2.List(2) = Date Then
A4.Caption = "Alarm !"
Else
' renvoi "En cours si la date est (>) à la date du jour
If (List2.List(0) > Date) Then A1.Caption = "En cours..."
If (List2.List(1) > Date) Then A2.Caption = "En cours..."
If (List2.List(2) > Date) Then A3.Caption = "En cours..."
If (List2.List(3) > Date) Then A4.Caption = "En cours..."
End If

1 réponse

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
13 août 2010 à 17:52
Ton code devrais plutôt ressembler à ceci

If (List2.List(0) <= Date) Then
  A1.Caption = "Alarm !"
Else
  A1.Caption = "En cours..."
End if

If (List2.List(1) <= Date) Then
  A2.Caption = "Alarm !"
Else
  A2.Caption = "En cours..."
End if

If List2.List(2) = Date Then
  A3.Caption = "Alarm !"
Else
  A3.Caption = "En cours..."
End if

If List2.List(2) = Date Then
  A4.Caption = "Alarm !"
Else
  A4.Caption = "En cours..."
End if





[i][b]---- Sevyc64 (alias Casy) ----
[hr]# LE PARTAGE EST NOTRE FORCE #/b/i
0
Rejoignez-nous