Results 1 to 7 of 7

Thread: Recordset status

  1. #1

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    How can you return a value which shows if a recordset is open or closed?
    Normal is boring...

    smh

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    To return a value from a recordset you must first create the recordset (Fill it with values)
    off the top I think it's like this in dao

    Dim sql as string
    sql = "Select aField from yourTable"
    data1.recordsource = sql
    data1.refresh

    to get the first record
    data1.recordset.movefirst
    myString = Data1.Recordset!yourfield
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    I don't think we were on the same line there, otherwise I am confused. I want to know if the recordset is open, not return a record. Here's my code:
    ________________________________________________
    Private Sub cboBankName_click()


    ***Want to know if the recordset is already open here***
    ***If the recordset is open THEN
    rst.close
    end if

    gstrHold = cboBankName.Text

    rst.Open "SELECT Banks.*, BankFees.* " & _
    "FROM BankFees INNER JOIN Banks ON BankFees.BankName = Banks.BankName " & _
    "WHERE FeeEndDate is NULL " & _
    "AND Banks.BankName = '" & gstrHold & "' ;", cnn, adOpenStatic, adLockOptimistic

    'Predefined subroutine
    FillBoxes



    End Sub
    Normal is boring...

    smh

  4. #4
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Check the "State" of the recordset.

    If rsValidate.State = adStateOpen Then
    ' do whatever
    End If

  5. #5

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    Thanks...Worked great.

    smh
    Normal is boring...

    smh

  6. #6
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Damn. Missed one of your threads - no more lunch for me...

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  7. #7

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    You deserve lobster for dinner after yesterday...

    smh
    Normal is boring...

    smh

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