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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error "Object Invalid or no longer set"

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
0
0
US
I need some idea how to capture what is triggering this error. It happens after I change the date on the form and then hit the Escape {ESC} key, it will undo the date change but it will then keep on giving me the error "Object Invalid or no longer set". Each time I hit the OK button it keeps on giving me in my SubForm in each field "Name?" it populates the "Name?" in each field after each time I hit OK.

I tried putting a message in On KeyDown Event procedure and see what happens after I hit the {ESC} key. but to no avail.

Please! if you got some idea, how to trap this creap I would appreciate your help.

Thanks in advance
 
have you stepped through your code by putting in a marker. and advancing using F8?
Sounds as though you are losing the recordsource of your subform.

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
I would also think so. I have error trappers in each Sub, if it happens in the Before Update or After Update Event Procedure it should pop up with the exact error. Unfortunately here its not popping up in any of the event procedures, it just annoys you, and basically the way to stop it, is by killing the Access Process through Task Manager.

Note!
I wrote it happens when I hit the {ESC} Key after I change the date, actually it happens in any field that I undo with the {ESC} Key.

Where would you put an error trapper in which Event procedure?
 
Pressing control+break with the message on the screen doesn't take you to the offending code?
 
Further to my last. Pressing control+break should take you to the error trap that is displaying the error message. Executing a resume (with no parameters) should take you to the offending code.
 
No! the Ctrl+Break brings the message of "Object Invalid" over and over again. Its not coming from a Error Trap that I have.

That is why I asked in which procedure would you suggest to create an Error Trap?
 
I would like to understand what event procedure takes place when I hit the {ESC} key? I would then put some testing code in there.
 
I believe the escape key triggers the Undo event for the control that has the focus, but only if there is something to undo i.e. the data in the control has changed since it got the focus.
Put debug.print "Escape pressed" (or somthing) in the undo event procedure for the date control, and set that line as a breakpoint.
Change the date and press escape and the code should break at msgbox...
Press F8 to step through the code.
Hope this helps.
 
Anoher seniors moment.
The code should break at the debug.print line!
 
I appreciate you help. The {ESC} key does not trigger the Undo Event Procedure, and therefore I posted another question what does the {ESC} Key do different then the Undo Event. I did not get any answers for that yet.

I see one thing the {ESC} Key can really mess you up, it can stop a requery and leave you without a recordsource. I am wondering how you can avoid that.
 
I'm using Access 2003.
Pressing Escape after changes are made to text boxes on a bound form, and a text box has the focus, triggers the FORM undo event.
Pressing escape whilst a combo box has the focus does not trigger the undo event.
Hope this helps.
 
Yes, I must agree the reason the On Undo did not take place was because the text box was not enabled and was filled in through the calendar with code.
 
I'm having a similar problem. Though it seems as though it is a session / connection timeout causing the problem.
See this thread

I'm using Access 2003 as my front end with links to a SQL Server 2005 database.

I seem to be periodically loosing my connection to the SQL tables.

I get the error "Object Invalid or no longer set" error periodically when a particular form is open or when I try to undo an edit on that specific form. No other forms generate this error.

Any thoughts?
Vince
 
Unfortunately, I still have the same issue and hope that when the process roles back to the form, the users won't hit the {ESC} Key.

If you find a solution please post it.

Thanks;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top