hello all
plz i am desperate with my code
it is not working
it keeps giving me this error: Next without For
i have a table, which looks as follows
courrier classe A B C D E F G H I J....Z
1 A
1 B 2 1 2 2 3 1
1 C
1 D 1 1 2 3
. .
. .
1 Z
2 A
2 B
i have an array called mes classes for example it has the following elements (B, D)
i read line by line this table, if the classe = myclasses(i), i create an array of numerators: classnum, where i put the classes which has a value of 1 or 2, and i create an array of denominators, where i put the classes whose values are 3 or 2
can anyone tell me why my code is not working
i would really appreciate it
toutesClasses = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
Set RS1 = db.OpenRecordset("A0TDEFAUT_SOUSPROT", dbOpenDynaset)
With RS1
.FindFirst "COURRIER = " & H & ""
.FindNext "COURRIER = " & H & ""
Do Until RS1.EOF
For i = 0 To nbr
If (RS1!Classe = mesClasses(i)) Then
nj = 0
dj = 0
cnj = 0
cdj = 0
For j = 0 To 25
clsFieldname = toutesClasses(j)
If RS1.Fields(clsFieldname) = 1 Or RS1.Fields(clsFieldname) = 2 Then
classeNum(nj) = toutesClasses(j)
nj = nj + 1
End If
If RS1.Fields(clsFieldname) = 3 Or RS1.Fields(clsFieldname) = 2 Then
classeDenom(dj) = toutesClasses(j)
dj = dj + 1
End If
Next j
If nj > 0 Then
counterNum(cnj) = nj - 1
cnj = cnj + 1
End If
If dj > 0 Then
counterDenom(cdj) = dj - 1
cdj = cdj + 1
End If
RS1.MoveLast
RS1.MoveNext
Else: Next i <--------------------- the error
End If
RS1.MoveNext
Loop
End With
RS1.Close
thanks in advance
i hope u can help; i am stuck here
Lanelouna
plz i am desperate with my code
it is not working
it keeps giving me this error: Next without For
i have a table, which looks as follows
courrier classe A B C D E F G H I J....Z
1 A
1 B 2 1 2 2 3 1
1 C
1 D 1 1 2 3
. .
. .
1 Z
2 A
2 B
i have an array called mes classes for example it has the following elements (B, D)
i read line by line this table, if the classe = myclasses(i), i create an array of numerators: classnum, where i put the classes which has a value of 1 or 2, and i create an array of denominators, where i put the classes whose values are 3 or 2
can anyone tell me why my code is not working
i would really appreciate it
toutesClasses = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
Set RS1 = db.OpenRecordset("A0TDEFAUT_SOUSPROT", dbOpenDynaset)
With RS1
.FindFirst "COURRIER = " & H & ""
.FindNext "COURRIER = " & H & ""
Do Until RS1.EOF
For i = 0 To nbr
If (RS1!Classe = mesClasses(i)) Then
nj = 0
dj = 0
cnj = 0
cdj = 0
For j = 0 To 25
clsFieldname = toutesClasses(j)
If RS1.Fields(clsFieldname) = 1 Or RS1.Fields(clsFieldname) = 2 Then
classeNum(nj) = toutesClasses(j)
nj = nj + 1
End If
If RS1.Fields(clsFieldname) = 3 Or RS1.Fields(clsFieldname) = 2 Then
classeDenom(dj) = toutesClasses(j)
dj = dj + 1
End If
Next j
If nj > 0 Then
counterNum(cnj) = nj - 1
cnj = cnj + 1
End If
If dj > 0 Then
counterDenom(cdj) = dj - 1
cdj = cdj + 1
End If
RS1.MoveLast
RS1.MoveNext
Else: Next i <--------------------- the error
End If
RS1.MoveNext
Loop
End With
RS1.Close
thanks in advance
i hope u can help; i am stuck here
Lanelouna