Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check whether a recordset is closed?

Status
Not open for further replies.

sohjai

Programmer
Nov 23, 2001
8
HK
What I want to know is, how can I check whether a recordset is closed or not??

This is my first time to write VB code, I guess this might be a very simple question, but I really have no idea how to do it at the moment.........
 
check the STATE of your recordset.

if recordset.STATE=0 then your recordset is closed.
 


Dim objRec as ADODB.Recordset
Set objRec = New ADODB.Recordset

objRec.Open "Select * From Accounts",objConn,adOpenDynamic, adLockOptimistic,adCmdText

If objRec.State = adStateClosed Then
MsgBox "Recordset could not be opened"
End If
 
Thank you for your help, one more question please

Then how can I check whether the recordset is set to Nothing?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top