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