| 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...
>
>
>
| |
|
|
"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]
|
|
|
|