object invalid or no longer set

D

doug

-----Original Message-----
I'm working with an Access 2000 database that has a fair
amount of code behind the forms. I am repeatedly getting
the error "object invalid or no longer set", but I'm not
able to trap the error. Access doesn't send me into the
debugger the way it usually does so that I can see where
the error occurred.

I've already read the knowledge base articles about object
references using the CurrentDB function, and how this can
cause the error. I've changed all references in my code
so that I'm always setting a database object variable
equal to the CurrentDb function, and then using that
variable to create my temporary querydefs. However, I'm
still getting the error.

Any ideas on what the problem could be or how I can debug
the problem?

Thanks,

Paul
.
Here is a way to find out where your error is occuring.

1. Make a global constant conDEBUG.
When ever you want to run in debug set conDEBUG = 1
Then set up your error handler like listing below.
When an error ocurrs the program will stop, and display
the errormessage. fress f8 three time and it will take you
to the statement causing the error

2.ErrHandler:

If conDEBUG > 0 Then
'Press f8 3 times to go to the line causing the
error
Stop
Debug.Print Err.Number & ": " & Err.Description
Resume
Else


MsgBox "Error Number " & Err.Number & vbCrLf &
Err.Description, vbCritical, Err.Source
End If

Hope it helps,
Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top