I've encountered a strange problem during some work with VBA and a DAO.Recordset. I'm currently looping throgh the recordset and save the corresponding fields for earch iteration in an array. But every time I call ".MoveNext" due to the while-loop, the information stored in the "rs.Fields.Field(i).Value" is being overwritten, thus the fields are unusable. I've figured this out during debugging.
Some relevant code:
If Not rs Is Nothing Then
If rs.RecordCount > 0 Then
With rs
While Not .EOF
ReDim Preserve fieldSet(0 To i + 1) As DAO.Fields
Set fieldSet(i) = rs.Fields
i = i + 1 ' the values are still intact at this point
.MoveNext ' here's where there's only "No current record" stored inside the value-field
Wend
End With
End If
Hopefully somebody has an idea what causes this. Thanks in advance.
next recordthe fields will be reset to the next record.. What do you mean by this?rs.Fields.Field(i).Value? or do you meanrs.Fields(i).Value? - bonCodigo