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
 
Back
Top