A
Amy Blankenship
I have cleanup code at the bottom of my code that runs on error and also
once the code finishes. This makes sure any open objects, such as
recordsets and querydefs, get properly destroyed under any circumstances.
The problem is that sometimes the code errors before something is open, or
the conditions in the code that determine if the object is initialized
aren't met. In that case, trying to close an open object results in an
error. I haven't been able to find a clean way to determine if an object
has been instantiated, as IsNull and IsEmpty don't seem to work. So I've
resorted to a really lame system of adding a boolean variable for each
object that could need to be closed that determines if it was opened. What
is the best way to handle this?
Thanks;
Amy
once the code finishes. This makes sure any open objects, such as
recordsets and querydefs, get properly destroyed under any circumstances.
The problem is that sometimes the code errors before something is open, or
the conditions in the code that determine if the object is initialized
aren't met. In that case, trying to close an open object results in an
error. I haven't been able to find a clean way to determine if an object
has been instantiated, as IsNull and IsEmpty don't seem to work. So I've
resorted to a really lame system of adding a boolean variable for each
object that could need to be closed that determines if it was opened. What
is the best way to handle this?
Thanks;
Amy