Quote Originally Posted by Norie
I'm sorry but I don't understand your questions fully.
...
How is the statement failing?
Sorry that I did not make things clearer. Consider the two procedures below. The only difference is that rst is not declared/typed in Test1 and it is declared/typed in Test2:
[VBA]Private Sub Test1()
Dim db As DAO.Database
Dim I As Long
'Dim rst As Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("Books")
rst.MoveFirst
While Not (rst.EOF)
I = I + 1
'
' other code
'
rst.MoveNext
Wend
MsgBox "# records processed = " & I
End Sub
[/VBA]
[VBA]Private Sub Test2()
Dim db As DAO.Database
Dim I As Long
Dim rst As Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("Books")
rst.MoveFirst
While Not (rst.EOF)
I = I + 1
'
' other code
'
rst.MoveNext
Wend
MsgBox "# records processed = " & I
End Sub[/VBA]
If Option Explict is "on" then
Test1 fails at compile at the Set rst = ... statement with a "variable not defined" error.
Test2 fails on execution at the Set rst = ... statement with a runtime error 13: Type MisMatch

If Option Explict is "off" then
Test1 runs to completion
Test2 fails on execution at the Set rst = ... statement with a runtime error 13: Type MisMatch

Thus if I have Option Explicit "off" and do not declare rst, the procedure runs. But if I declare rst what I think it should be, the procedure fails.

Quote Originally Posted by Norie
I'm sorry but I don't understand your questions fully.

What are you actually trying to do?
...
I want to search through all records of a dataset. The initial search can use the sequential methods of .movefirst, .movenext, etc. But later I will want to go to specific records and do not want to sequentially search through the records each time. It is not efficient to step through 6000 records when I know I want record 6001. Make sense?