Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303

    Unanswered: Is recordset open?

    How do you check to see if a recordset is open?
    Closing it if when it does not exist causes an error.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    If Recordset.State = adStateOpen then
    .
    .
    'Recordset is open
    .
    .
    Else
    .
    .
    'Recordset is closed
    .
    .
    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!

  3. #3
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    what is the reference (dll or olb) necessary?

    Perhaps I should have mentioned this is Access XP and I am using DAO recordsets.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  4. #4
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    I thought you were using ADO, with DAO do as follows instead:

    On Error Resume Next
    Recordset.Close
    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!

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Dim Rs as Recordset
    Rs.State = 1
    means opened

    Rs.State =0
    means closed

  6. #6
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Hello Hammbakka, that is true for ADO recordsets, however the question pretains to DAO recordsets that do not have the state property.

    For ADO do this:

    If Recordset.State = adStateOpen then
    .
    .
    'Recordset is open
    .
    .
    Else
    .
    .
    'Recordset is closed
    .
    .
    End If

    For DAO do this:

    On Error Resume Next
    Recordset.Close
    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!

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Thanks Scirocco,
    I haven't seen that concerning the DAO, you are right.

  8. #8
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    gentlemen - thanks for the feedback.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

Posting Permissions

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