If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Test if ADO recordset is open?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jul 2002
Location: Island of Dots
Posts: 316
Test if ADO recordset is open?

How can I test if an ADO recordset is open in code? The following do not work:

If rs1.Open = True then Exit Sub

or...

If rs1 <> Empty Then Exit Sub

Any help greatly appreciated.
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 745
Try

if rs1.State=1 then exit sub

MTB
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Jul 2002
Location: Island of Dots
Posts: 316
Cheers, that worked perfectly.
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Mar 2004
Location: www.scirocco.ca
Posts: 346
Just one small addition you are better off using the VB constants as it makes your code more legible i.e.

If rs.State= adStateOpen then
.
.
.
End If
__________________
http://www.scirocco.ca/images/banner...occobanner.gif

Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

Or try our Ask An Expert service to answer any of your questions!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On