Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77

    Unanswered: How to check the recordset is not open?

    If I declared recordset rs somewhere, in middle of the code, I open it with some conditions.
    In the later, I want to check rs is whether open, if its open, I do something, if its not, I do other things.

    Anybody have idea:
    Thanks a lot

  2. #2
    Join Date
    Mar 2004
    Location
    Oakland, CA, USA
    Posts
    26

    RE: How to check the recordset is not open?

    Hello Huela,

    Try this. Just my workaround solution! Hope it helps.

    '------------------------
    Dim myDB As Database
    Dim mySet As Recordset
    Dim temp

    Set myDB = CurrentDb
    Set mySet = myDB.OpenRecordset("Table1")

    'populate recordset statements here

    mySet.Close

    On Error Resume Next
    temp = mySet.Transactions
    If Err.Number = 3420 Then
    MsgBox "Recordset is close"
    Else
    MsgBox "Recordset is open"
    End If
    On Error GoTo 0
    '------------------------------

  3. #3
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77
    thank you very much

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can ask whether your Object is set or not, try:
    PHP Code:
      If Not rs Is Nothing Then
       msgbox 
    "Object is SET"
      
    Else 
        
    msgbox "Object is NOT SET"
      
    END IF 

  5. #5
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77
    hammbakka:

    This is good help. thanks a lot. it works fine now

Posting Permissions

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