I get the error '3021' for this: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Heres the code:
Where am I making a mistake
Option Compare Database
Public Sub IterateRows()
Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim i As Integer
Set conn = CurrentProject.Connection
'conn.Open
rst.Open "401165_406282", conn, adOpenForwardOnly, adLockOptimistic, adCmdTable
rst.MoveFirst
Do Until rst.EOF
rst.Find "Field5 = 'FDC'", 1, adSearchForward
Debug.Print rst.Fields("Field5").Value
rst.MoveNext
Loop
rst.Close
conn.Close
End Sub
Heres the code:
Where am I making a mistake
Option Compare Database
Public Sub IterateRows()
Dim conn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim i As Integer
Set conn = CurrentProject.Connection
'conn.Open
rst.Open "401165_406282", conn, adOpenForwardOnly, adLockOptimistic, adCmdTable
rst.MoveFirst
Do Until rst.EOF
rst.Find "Field5 = 'FDC'", 1, adSearchForward
Debug.Print rst.Fields("Field5").Value
rst.MoveNext
Loop
rst.Close
conn.Close
End Sub