mffm
mffm

Reputation: 386

VBA / Access: How is a DAO record set represented?

Maybe this question is quite basic, but I think it's important to understand it.

Assuming we perform a database query which will result in a result set looking like this:

[A1][B1][C1][D1][E1][F1]

[A2][B2][C2][D2][E2][F2]

[A3][B3][C3][D3][E3][F3]

So, index NUMBER is the representing the row, index LETTER is representing the column.

So, would the result set be an array?

How could I e.g. access the second row?

Upvotes: 0

Views: 86

Answers (2)

Doug Coats
Doug Coats

Reputation: 7107

Here is how you'd access a particular record

rs.MoveFirst
rs.Move 2

or

dim TestValue as long
TestValue = 2
Do While True
    If rs!TestField = TestValue Then Exit Do
    rs.MoveNext
    If rs.EOF then Exit Do
Loop

or

 rs.AbsolutePosition = 2

Upvotes: 2

ClintB
ClintB

Reputation: 509

access the third column(0,1,2)

recordset.fields(2)

or

recordset.fields("fieldName")

go to the next record(row)

recordset.movenext

move to a specific record

recordset.move

Upvotes: 1

Related Questions