sub text1_keypress(keyascii as integer) if (keyascii<48 and keyascii>57) or keyascii<>13 or keyascii<>8 or keyascii<>47 then KeyAscii=0 end sub
sub text1_lostfocus() 'Test la longueur if len(text1.text)<>8 then msgbox "Date incorrect" 'Test les "/" if mid(text1.text,3,1)<>"/" or mid(text1.text,6,1)<>"/" then msgbox "Date incorrecte" end sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Text1_LostFocus() If Not IsNumeric(Text1.Text) Then MsgBox "Ce n'est pas une entrée numérique" Text1.Text = "" Text1.SetFocus Else MsgBox "Gagné on passe à autre chose" End If End Sub Private Sub Text2_LostFocus() If Not IsDate(Text2.Text) Then MsgBox "Ce n'est pas une entrée numérique" Text2.Text = "" Text2.SetFocus End If End Sub
If TxtDatEcr = "" Or Not IsDate(TxtDatEcr.Text) Then MsgBox "La date n'est pas valide", vbOKOnly, "Attention!"