global ADO object

T

thread

Hi all,
i'm using an ADO object on the form and i'm using it on several of
functions
my problem is that when i'm trying to use this object more then
once,i'm getting an error that the object is opened even that i'm
closing it.
maybe the issue comes from the reason that the object is closed and i
need to allocate it again?
can you please advice
 
B

Brendan Reynolds

It's not clear just which object in the ADO library you're using, but I'm
guessing it's most likely a Connection or a Recordset object. If I remember
correctly I believe that both of these objects have a State property that
you can check to determine if they are currently open or not. Something like
(untested air-code) ...

If rstWhatever.State <> adStateClosed Then
rstWhatever.Close
End If
 
Top