"Operation invalid without a current index"

D

De Veloper

Does anyone know what this means.

I get this error message when I try to run a query imported into a Access
2003 mdb from a '97 mdb.

The query is a select query that pulls information from tables in the .mdb
and linked tables from the Oracle server.
 
B

Brendan Reynolds

That's the error you get when you try to call the Seek method of a Recordset
object without first setting the Index property. For example, the code below
will demonstrate the error. Note the commented out line. Uncomment that line
to fix the error.

You can't call Seek directly from a query - but perhaps your query includes
a VBA function that calls Seek?

Public Sub TestSub()

Dim db As DAO.Database
Dim rst As DAO.Recordset

On Error GoTo ErrorHandler
Set db = CurrentDb
Set rst = db.OpenRecordset("Table1")
'rst.Index = "PrimaryKey"
rst.Seek "=", 1
Debug.Print rst.Fields(0).Value

ExitProcedure:
On Error Resume Next
rst.Close
Exit Sub

ErrorHandler:
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume ExitProcedure

End Sub
 
D

De Veloper

You are the best...thanks for this vital information....everything is working
just fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top