J
joao
Hi
i am using this loop to retrieve data from a recordset. The problem is
that when the while loop ends, it goes to the next (line 10) which is
fine, but then it goes to line 3 and not to line 2 where it was
supposed to go to the next c (the next field in the recordset). I have
already tried to put the next just after the for, and it worked fine
(but in this case its only possible to get the fields names or values,
but not all records). i have also tried to replace the while fo another
for... next but it didn´t worked also.
Any clues?
1 With rstRecordset
2 For Each c In .Fields
3 b = b + 1
4 While Not .EOF
5 ThisWorkbook.Sheets("entradas").Select
6 Cells(a, b).Value = c.Value
7 a = a + 1
8 rstRecordset.MoveNext
9 Wend
10 Next c
11 End With
i am using this loop to retrieve data from a recordset. The problem is
that when the while loop ends, it goes to the next (line 10) which is
fine, but then it goes to line 3 and not to line 2 where it was
supposed to go to the next c (the next field in the recordset). I have
already tried to put the next just after the for, and it worked fine
(but in this case its only possible to get the fields names or values,
but not all records). i have also tried to replace the while fo another
for... next but it didn´t worked also.
Any clues?
1 With rstRecordset
2 For Each c In .Fields
3 b = b + 1
4 While Not .EOF
5 ThisWorkbook.Sheets("entradas").Select
6 Cells(a, b).Value = c.Value
7 a = a + 1
8 rstRecordset.MoveNext
9 Wend
10 Next c
11 End With