473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Meaning of "Object Invalid or no longer set"?

I'm getting intermittent "Object Invalid or No Longer Set" errors in my
Access 2002 mdb.

What causes these errors?

Has anyone dealt with this before?

I can't trace it because it's not easy to duplicate -- it just show up...

I've heard that spurious queries that use Now() or Date() or some other date
function can cause this error. ???

Any suggestions welcome!!

Thanks!
Nov 12 '05 #1
7 36636
Here's what I've found so far:

http://support.microsoft.com/default...b;en-us;243459

http://support.microsoft.com/default...roduct=acc2000

also something about the the latest Jet service pack ... which I think I
already have
"deko" <dj****@hotmail.com> wrote in message
news:zC***********@newssvr27.news.prodigy.com...
I'm getting intermittent "Object Invalid or No Longer Set" errors in my
Access 2002 mdb.

What causes these errors?

Has anyone dealt with this before?

I can't trace it because it's not easy to duplicate -- it just show up...

I've heard that spurious queries that use Now() or Date() or some other date function can cause this error. ???

Any suggestions welcome!!

Thanks!

Nov 12 '05 #2
Although my scenario is different, it's similar enough for me to think that
this might be it... comments welcome!!

(below taken from Microsoft Knowledge Base Article - 200592)

The following example attempts to use the CurrentDb function to return a
pointer to the database that is currently open in Microsoft Access. Because
the code does not assign that database to an object variable, the pointer
returned by the CurrentDb function is temporary and becomes invalid after
the TableDef object is set. Consequently, any later references in your code
to the TableDef object variable will result in an error.
1.. Start Access and open the sample database Northwind.mdb.
2.. Create a module and type the following procedure:
Sub CurrentDbFail()
Dim td As DAO.TableDef
Set td = CurrentDb.TableDefs("Customers")
MsgBox td.Name
End Sub 3.. To test this procedure, type the following line in the
Immediate window, and then press ENTER:
CurrentDbFail Note you receive the error described in the Symptoms
section of this article
"deko" <dj****@hotmail.com> wrote in message
news:zC***********@newssvr27.news.prodigy.com...
I'm getting intermittent "Object Invalid or No Longer Set" errors in my
Access 2002 mdb.

What causes these errors?

Has anyone dealt with this before?

I can't trace it because it's not easy to duplicate -- it just show up...

I've heard that spurious queries that use Now() or Date() or some other date function can cause this error. ???

Any suggestions welcome!!

Thanks!

Nov 12 '05 #3
This is the recordset operation I'm using:

Public Sub SyncForms()
Dim lngEid As Long
Me.Requery
lngEid = Form_frmCn.Entity_ID
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst ("Entity_ID=" & lngEid)
If rst.NoMatch Then
MsgBox ("Can't find Entity ID " &
Forms!frmMain!frmCn!Entity_ID), , "Error Ac84"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
Set rst = Nothing
End Sub
What this does is move the current form to the record that was being viewed
(the current record) in frmCn -- which is a form that it part of a series of
tabbed forms. So, when the user selects a record from a list on frmCn, and
then changes tabs, SyncForms is called and the database moves to that record
in the new form (frmTx). The problem seems to arise when changes are made
to the data in frmTx...

or perhaps I'm totally wrong, and it's something else...

"deko" <dj****@hotmail.com> wrote in message
news:zC***********@newssvr27.news.prodigy.com...
I'm getting intermittent "Object Invalid or No Longer Set" errors in my
Access 2002 mdb.

What causes these errors?

Has anyone dealt with this before?

I can't trace it because it's not easy to duplicate -- it just show up...

I've heard that spurious queries that use Now() or Date() or some other date function can cause this error. ???

Any suggestions welcome!!

Thanks!

Nov 12 '05 #4
TS

"deko" <dj****@hotmail.com> wrote in message
news:zC***********@newssvr27.news.prodigy.com...
I'm getting intermittent "Object Invalid or No Longer Set" errors in my
Access 2002 mdb.

What causes these errors?

Has anyone dealt with this before?

I can't trace it because it's not easy to duplicate -- it just show up...

I've heard that spurious queries that use Now() or Date() or some other date function can cause this error. ???

Any suggestions welcome!!

Thanks!

I'm assuming you are getting this in your VB code. Try commenting out your
"on error" statement so when the error occurs it will put you on the
offending line. You are probably trying to close or reference an object
that is not open.

If it is a connection you are closing, for example, try:

If conn.state = AdStateOpen then conn.close

Hope this helps
Ken
Nov 12 '05 #5
> lngEid = Form_frmCn.Entity_ID

That should be:

lngEid = Forms!frmCn.Entity_ID

.... or ...

lngEid = Forms("frmCn").Entity_ID
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst ("Entity_ID=" & lngEid)
If rst.NoMatch Then
MsgBox ("Can't find Entity ID " &
Forms!frmMain!frmCn!Entity_ID), , "Error Ac84"
Else


You also need to take another look at your MsgBox () syntax, because it is
incorrect. You need to remove the parentheses as these are required only when
you are retrieving the value returned from the MsgBox() function, as in:

If MsgBox("Can you answer this question?", vbYesNo) = vbYes
'You answered "Yes"
Else
'You answered "No"
End If

--
Bruce M. Thompson
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #6
Thanks for the tips, and I will correct my syntax, but I don't think that is
the casue of the problem.

I've narrowed it down to a Datasheet form that has a query as a
recordsource -- if I make changes (in-cell editing) to the datasheet, and
then change to a different tab in my tabbed form set, and back, I get the
Invalid Object error.

I'm not sure if I need to requery, reassign the recordsource, or both, after
something is changed in the Datasheet:

Private Sub Form_AfterUpdate()
modAssign.Modified 'updates modification date
Me.Requery
Me.RecordSource = "qryTxHist_Ac"
End Sub

In any case, I am still fighting that elusive enemy "Object Invalid or No
Longer Set" -- a.k.a Run-time error '3420'

any help is greatly appreciated!

"Bruce M. Thompson" <bthmpson@big_NOSPAM_foot.com> wrote in message
news:vo************@corp.supernews.com...
lngEid = Form_frmCn.Entity_ID
That should be:

lngEid = Forms!frmCn.Entity_ID

... or ...

lngEid = Forms("frmCn").Entity_ID
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst ("Entity_ID=" & lngEid)
If rst.NoMatch Then
MsgBox ("Can't find Entity ID " &
Forms!frmMain!frmCn!Entity_ID), , "Error Ac84"
Else


You also need to take another look at your MsgBox () syntax, because it is
incorrect. You need to remove the parentheses as these are required only

when you are retrieving the value returned from the MsgBox() function, as in:

If MsgBox("Can you answer this question?", vbYesNo) = vbYes
'You answered "Yes"
Else
'You answered "No"
End If

--
Bruce M. Thompson
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<

Nov 12 '05 #7
> Thanks for the tips, and I will correct my syntax, but I don't think that is
the casue of the problem.
Well, it certainly could be the cause of *some* problems because numerous parts
of your code would not have run as written. If this was caused by typos while
typing the code into the message (as opposed to copying from the subroutine and
then pasting to the message) then this would not be an issue.
I've narrowed it down to a Datasheet form that has a query as a
recordsource -- if I make changes (in-cell editing) to the datasheet, and
then change to a different tab in my tabbed form set, and back, I get the
Invalid Object error.
I suspect that you need to examine your forms' modules for any other code that
might contain errors. If this is not the case, your project might be in need of
compacting or, possibly, decompiling. There is a "decompile" switch (available
in Access 97, 2000 and, apparently, 2002) that can be used to help correct this
situation, but this is more of a "last resort" in that there is some risk to the
file as described in http://www.trigeminal.com/usenet/usenet004.asp?1033 (so ...
work with a copy of the file). Further information is available at
http://www.databasecreations.com/Dat...rmanceTips.pdf. The procedure I
use when implementing this is as follows:

1) BACK UP YOUR MDB FILE!
1) BACK UP YOUR MDB FILE! (I meant it the first time <g>)
2) Compact the MDB.
3) Implement the "/decompile" as described in the articles I referenced.
(Access 2000, and later, don't provide the confirmation dialog that
existed in Access 97, but the decompile will still take place.)
4) Open Access normally and compact the MDB again to clean up.
5) Compile and save.
6) Compact again before testing/using.
I'm not sure if I need to requery, reassign the recordsource, or both, after
something is changed in the Datasheet:
Neither should be necessary.
Private Sub Form_AfterUpdate()
modAssign.Modified 'updates modification date


How, exactly, does this update a field's value? You didn't mention this before.
Was this added after you posted the message to which I last replied?

--
Bruce M. Thompson
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
I have an Access 2000 database with a form that is giving me some major headaches. When you open the form, it displays all records and allows editing, but has AllowAdditions set to False so that...
7
by: (Pete Cresswell) | last post by:
We were testing a version of our app that's been running for months with no problems and it started throwing "Object no longer exists" messages on two machines in the test environment. We tried...
6
by: Lauchlan M | last post by:
Hi. Usin ASP.NET, getting an "Object reference not set to an instance of an object" error. In my login.aspx page I have: string arrUserRoles = new string {"UserRole"};...
1
by: Lauchlan M | last post by:
Hi. I'm using ASP.NET, getting an "Object reference not set to an instance of an object" error. In my login.aspx page I have: string arrUserRoles = new string {"UserRole"};...
35
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an...
3
by: Michel Couche | last post by:
Hello, I have an ASP.Net application that uses the Wizard control to build a newsletter. There are three steps in the wizard. The customer's specific design data are loaded from a database in...
3
by: =?Utf-8?B?QmFkaXM=?= | last post by:
I'm doing a server side automation(I know it's bad but..) and its working fine locally and when accessing it from a remote machine using web browser is was giving me this error"Retrieving the COM...
0
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
3
by: FelixSmith | last post by:
I have recently posted a new access database and its oracle tables onto a shared folder for various users. It is a search database and me and a few other users are able to pull from the file and use...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.