How to tell if a recordset is open?

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

Guest

Is there a way I can find out if a recordset is open? Specific VBA syntax
please?

Thanks a million!
 
ADO recordsets have a State property which is equal to adStateClosed if the
recordset is closed ...

If Not mrst Is Nothing Then
If mrst.State <> adStateClosed Then
mrst.Close
End If
End If

DAO recordsets do not have such a property. I use a Boolean variable to keep
track of the state of DAO recordsets ...

Set rst = db.OpenDatabase(strSQL)
boolOpen = True
....
rst.Close
boolOpen = False
....
If boolOpen Then
rst.Close
boolOpen = False
End If
 

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