Handy IsOpen(ADODBs) Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.
Is there some way I can test and see if those recordsets, connections, tables and whatnot are open? Probably not? What about error-trapping them closed when my dumb code makes stuff spin out of control?
All this is way more, "robust," than it used to be 10 yrs ago
 
Hi,
If you're using ADO, both the Connection and Recordset objects have a State peoperty
that will tell you if they are open or not.
Ths allows you to write code like this:

If cnn.State = adStateOpen Then
cnn.Close
End If

If Not cnn Is Nothing Then
Set cnn = Nothing
End If

--
HTH
Dan Artuso, Access MVP


Jim Shores said:
Hi.
Is there some way I can test and see if those recordsets, connections, tables and whatnot are open? Probably not? What about
error-trapping them closed when my dumb code makes stuff spin out of control?
 

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

Back
Top