May 29, 2002 #1 xq Programmer Jun 26, 2002 106 NL just want to copy recordset to an multi-dimension array. thanks a lot!
May 29, 2002 Thread starter #2 xq Programmer Jun 26, 2002 106 NL what's wrong with that? it doesnt' work i = 0 r = rs.RecordCount f = rs.Fields.Count ReDim arr(r, f) Do While Not rs.EOF On Error Resume Next For j = 0 To f - 1 arr(i, j) = rs.Fields(j).Value Next j On Error GoTo 0 rs.MoveNext i = i + 1 Loop Upvote 0 Downvote
what's wrong with that? it doesnt' work i = 0 r = rs.RecordCount f = rs.Fields.Count ReDim arr(r, f) Do While Not rs.EOF On Error Resume Next For j = 0 To f - 1 arr(i, j) = rs.Fields(j).Value Next j On Error GoTo 0 rs.MoveNext i = i + 1 Loop
May 30, 2002 #3 ThinLizzy Programmer May 30, 2002 12 NL The problem is the the record/fields .count don't work. You must add following code: rs.MoveLast rs.MoveFirst and then: r = rs.RecordCount f = rs.Fields.Count ..... Hope this will help you, ThinLizzy Upvote 0 Downvote
The problem is the the record/fields .count don't work. You must add following code: rs.MoveLast rs.MoveFirst and then: r = rs.RecordCount f = rs.Fields.Count ..... Hope this will help you, ThinLizzy
May 30, 2002 #4 mikewoodhouse Programmer Mar 14, 2002 79 GB ALternatively, try looking at the GetRows method. e.g. Dim arr As Variant ' needs to be a variant arr=rs.GetRows ' in ADO that's all you need to do! Upvote 0 Downvote
ALternatively, try looking at the GetRows method. e.g. Dim arr As Variant ' needs to be a variant arr=rs.GetRows ' in ADO that's all you need to do!