Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seek Method Problem

Status
Not open for further replies.

Gerbers404

Programmer
Jun 11, 2001
84
US
Hi there, I am getting a Run-time Error '3219' - Invalid Operation Error in the following code.

Private Sub JN_AfterUpdate()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblSpecCondCurrent", dbOpenTable)
rs.Index = "Cond_ID"
rs.Seek "=", Me.Cond_ID
Me.Bookmark = rs.Bookmark
Me.Volume.Visible = True
End Sub

I get the error as I try to set the recordset. Any Ideas?

Thanks!

Gerbers404
 
You are using DAO code which is not explicitly 'Dimensioned' in you code which means you must be using Access 97 or earlier. If you have opened this using Access 2000 or Access XP or it is a .ADP file then it would not work.

The following should work if you are still accessing the data using the Jet database engine.

Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblSpecCondCurrent", dbOpenTable)
rs.Index = "Cond_ID"
rs.Seek "=", Me.Cond_ID
Me.Bookmark = rs.Bookmark
Me.Volume.Visible = True
End Sub

Otherwise set a breakpoint at the error line and when it stops type this into the debug/immediate window.

?Db Is Nothing

If it says True then the database is not getting set to a DAO.Database object. This happens when you are using Jet.



-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top