Results 1 to 2 of 2

Thread: Opening a Recordset (ADO 2.5)

  1. #1
    Guest
    I have an ADO connection and a few recordsets; One of them I have to query a lot.
    When I do this:

    RS.Open "SELECT * FROM TableName WHERE FieldName = " & ID, DB, adOpenForwardOnly, adLockReadOnly


    It gives me an error saying:
    Runtime error '3705':
    Operation is not allowed when the object is open.


    I know I need to close the recordset before querying it again, but when I try to use RS.Close, it says it can't because the object is already closed.

    From that I understand that I can call RS.Close only when it's open, but how do I check if the Recordset is open or closed?

    And another question:

    If I create a connection like this:

    DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\database.mdb"


    Do I have to include a reference to MSJRO.DLL - Microsoft Jet and Replication Objects 2.5 Library?


    Thanks.

  2. #2
    New Member
    Join Date
    Sep 2000
    Location
    Burbank
    Posts
    3

    Wink

    That one if the recordset is open
    if rs.state = adstateopen then
    rs.close
    set rs = nothing
    end if

    This other one if the recordset is closed:

    if rs.state = adstateclosed then
    your code to open the connection
    end if






    U Little Piece of Code!!!!

Posting Permissions

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



Click Here to Expand Forum to Full Width