Results 1 to 4 of 4

Thread: Closing recordset

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Malaysia
    Posts
    69
    Is there a way to determine whether a recordset has been instantiated ?
    For eg.If I have

    Option Explicit

    Dim rstDetail As ADODB.recordset
    :
    :
    :
    :
    Set rstDetail = Conn.Execute("SELECT * FROM Table",,adcmdText)
    :
    :

    If there is a runtime error when executing the above statement, the program will exit. During the exiting function, I will close every recordset that I dimmed but for the above recordset, I will have an error coz' the recordset is not created. So, is there anyway to check the status ? I tried to use 'rstDetail.state = adStateOpen' but failed because this cannot determine whether the recordset has been instantiated.

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Check if it is nothing, or empty or null or something. Don't know which becuse i haven't used a recordset in ages.
    Iain, thats with an i by the way!

  3. #3
    Lively Member
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    84

    Question

    I don't know if it works, but try setting it to nothing first:

    Code:
    Set rstDetail = Nothing

  4. #4
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    When I close a form, I close all my recordsets when I unload the form. If any of the recordsets are not open, and error ocurrs (3704) which I just trap and resume next.

    It works for me

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