473,657 Members | 2,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 36694
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.n ews.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.Table Defs("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.n ews.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.Enti ty_ID
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClo ne
rst.FindFirst ("Entity_ID= " & lngEid)
If rst.NoMatch Then
MsgBox ("Can't find Entity ID " &
Forms!frmMain!f rmCn!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.n ews.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.n ews.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.Enti ty_ID

That should be:

lngEid = Forms!frmCn.Ent ity_ID

.... or ...

lngEid = Forms("frmCn"). Entity_ID
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClo ne
rst.FindFirst ("Entity_ID= " & lngEid)
If rst.NoMatch Then
MsgBox ("Can't find Entity ID " &
Forms!frmMain!f rmCn!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.o rg (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_AfterUpdat e()
modAssign.Modif ied '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_N OSPAM_foot.com> wrote in message
news:vo******** ****@corp.super news.com...
lngEid = Form_frmCn.Enti ty_ID
That should be:

lngEid = Forms!frmCn.Ent ity_ID

... or ...

lngEid = Forms("frmCn"). Entity_ID
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClo ne
rst.FindFirst ("Entity_ID= " & lngEid)
If rst.NoMatch Then
MsgBox ("Can't find Entity ID " &
Forms!frmMain!f rmCn!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.o rg (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_AfterUpdat e()
modAssign.Modif ied '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.o rg (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
4614
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 the user has to use my New Record button. When you click the New Record button, the form presents a new record for editing. My client wants to use the Escape key to cancel changes to new or existing records. On existing records, Access already...
7
3409
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 the same test scenario on a production box: no problems. Tried them on my developer box: no problems. In each of those two cases, the PC's were connected to the same test server and *supposedly* had the same production build image on them. ...
6
19936
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"}; Context.Items.Add("UserRoles", arrUserRoles); Context.User = new
1
2351
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"}; Context.Items.Add("UserRoles", arrUserRoles); Context.User = new
35
3202
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 instance of an object" for the line 'If mpg.FindControl("lkred").Visible = True Then'. I couldn't find sofar the solution. Any help would be appreciated ... Thanks
3
2876
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 step 1 of the wizard and saved into a session variable. In step 2, when the user clicks on a button, I load the design data from the session variable and these are saved for further handling in a HashTable. The HashTable is defined in the...
3
2983
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 class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005". so I configured the server using dcomcnfg as described in this link: http://support.microsoft.com/kb/288368/ and know...
0
2213
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 Server 2000 We are having some problems with a website we are developing, and had some
3
4130
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 it perfectly. But, when other users pull from the shared folder they suffer from dragging performance and then the fields within the forms error to "#Name?" and an "Object Invalid or No Longer Set" error button comes up. Seeing as though we...
0
8316
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.