Sub cursorMove()
Dim conn As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentProject.Path & "\mydb.mdb"
Set myRecordset = New ADODB.Recordset
With myRecordset
.Open "Customers", conn, adOpenKeyset, adLockOptimistic
.Filter = "City='Madrid' and Country='Spain'"
End With
Do Until myRecordset.EOF
Debug.Print myRecordset.Fields(1).Value
myRecordset.MoveNext
Loop
myRecordset.Close
Set myRecordset = Nothing
conn.Close
Set conn = Nothing
End Sub
|