Bonjour,

Je cherche à faire une table de multiplication avec restriction des variables compris entre 0 et 10.

ci-dessous mon code :

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
Sub pythagore()
 
Dim nb1 As Integer
Dim nb2 As Integer
Dim total As Integer
Const fin = 10
 
nb1 = InputBox("veuillez rentrez un nombre 1")
    While nb1 > 10
        While nb1 < 0
            nb1 = InputBox("veuillez rentrez un nombre 1")
            total = nb1
        Wend
    Wend
 
nb2 = InputBox("veuillez rentrez un nombre 2")
    While nb2 > 10
        While nb2 < 0
            nb2 = InputBox("veuillez rentrez un nombre 2")
            total = nb1 * nb2
        Wend
    Wend
 
total = nb1 * nb2
total = MsgBox("resultat : " & total)
 
End Sub
Lorsque je lance mon algo avec une variable > 10 ou < 0, Access plante et ne prend pas mes boucles "tant que". comment dois je procéder?

Merci par avance,