Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 304536 - Last Review: September 26, 2005 - Revision: 2.3
FIX: "Object invalid or no longer set" Error with Microsoft Jet
This article was previously published under Q304536
When opening and closing connections or recordsets using the Microsoft ODBC Driver for Access or the Microsoft OLE DB Provider for Jet, the following error may be reported:
Object invalid or no longer set.
After this error is reported, no more recordsets or connections can be opened from the same process.
Other possible error messages reported to the client application include:
Cannot open any more tables.
To resolve this problem, install the latest Microsoft Jet 4.0 service pack 6.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
239114Â
(http://kbalertz.com/Feedback.aspx?kbNumber=239114/
)
How To: Obtain the Latest Service Pack for the Microsoft Jet 4.0 Database Engine
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was fixed in Jet 4.0 Service Pack 6 (SP6).
To reproduce the problem, run the following Microsoft Visual Basic for Applications (VBA) code:
Public Sub Jet_TableID_Repro()
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.recordset
Dim i As Long
Set conn = New ADODB.Connection
' Modify this connection string to point to some blank database.
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\YourTestDatabase.mdb;"
' Drop and re-create test query.
On Error Resume Next
conn.Execute "drop procedure sp_param_test", , adExecuteNoRecords
On Error GoTo 0
conn.Execute "create procedure sp_param_test as " & _
"parameters iInput Long; " & _
"select iInput as iOutput;", , adExecuteNoRecords
For i = 1 To 10000
' Code should fail at around 2000-3000 iterations.
Set rs = New ADODB.recordset
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_param_test"
cmd.Parameters.Append cmd.CreateParameter("iInput", adInteger)
cmd.Parameters(0).value = 12
' This will fail at around 2000-3000 iterations.
rs.Open cmd, , adOpenKeyset, adLockOptimistic
Set cmd = Nothing
Debug.Print i
DoEvents
rs.Close
Set rs = Nothing
Next i
End Sub
APPLIES TO
- Microsoft Open Database Connectivity Driver for Access 4.0
- Microsoft OLE DB Provider for Jet 4.0
| kbhotfixserver kbqfe kbjet kbprb kbqfe KB304536 |
Retired KB Content DisclaimerThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate