Results 1 to 4 of 4
  1. #1
    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.

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    756
    Try

    if rs1.State=1 then exit sub

    MTB

  3. #3
    Join Date
    Jul 2002
    Location
    Island of Dots
    Posts
    316
    Cheers, that worked perfectly.

  4. #4
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •