Home > Archive > MS Access data conversion > December 2005 > "Operation invalid without a current index"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author "Operation invalid without a current index"
De Veloper

2005-10-27, 8:31 am

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.


Brendan Reynolds

2005-10-27, 8:31 am

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



--
Brendan Reynolds


"De Veloper" < DeVeloper@discussion
s.microsoft.com> wrote in message
news:7052CEAB-43BD-4C1A-8143- 1C6EFC31CC9B@microso
ft.com...
> 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.
>
>



De Veloper

2005-10-27, 8:31 am

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


"Brendan Reynolds" wrote:

> 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
>
>
>
> --
> Brendan Reynolds
>
>
> "De Veloper" < DeVeloper@discussion
s.microsoft.com> wrote in message
> news:7052CEAB-43BD-4C1A-8143- 1C6EFC31CC9B@microso
ft.com...
>
>
>

2005-12-08, 3:25 am


"De Veloper" < DeVeloper@discussion
s.microsoft.com> wrote in message
news:95D17337-3D4C-4799-AE88- 3A347AD63BAE@microso
ft.com...
> You are the best...thanks for this vital information....everything is

working[color=darkre
d]
> just fine.
>
>
> "Brendan Reynolds" wrote:
>
Recordset[color=dark
red]
below[color=darkred]

line[color=darkred]
includes[color=darkr
ed]
Access[color=darkred
]
..mdb[color=darkred]


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com