Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Dallas, TX

    Unanswered: what's wrong with my disonnected recordset

    I have the sub to do the disconnected recordset, If i didn't close the connection, the sub works fine, display exactly what i want, but once i disconnect, the data can't be displayed anymore, what's wrong with my disconnected recordset. Thanks million.
    The error message is: the object you entered is not valid recordset propery

    Sub display3()
    On Error GoTo Err_display3
    Dim con As New ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim strSQL As String
    Dim i As Integer
    Dim frm As Form
    Set frm = Me![frmparentDeal].Form

    Set con = CurrentProject.Connection
    Set rs = New ADODB.Recordset
    strSQL = "Select Fund, Deal, [Deal Name] from dbo_tbl_irrdeals where fund = '" _
    & txtEntityGroup.Value & "'"
    With rs
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
    .LockType = adLockBatchOptimistic
    .ActiveConnection = con
    .source = strSQL
    .Fields.Append "selection", adBoolean, , 1
    Debug.Print rs.RecordCount
    End With

    Set rs.ActiveConnection = Nothing 'disconnect
    'error on this line : object you entered is not valid recordset property

    'error: operation is not allowed is not allowed when object is close
    'go to top of the recordset
    Set frm.Recordset = rs

    Exit Sub
    MsgBox Err.description
    Resume Exit_display3
    End Sub
    Last edited by huela; 10-12-04 at 15:31.

  2. #2
    Join Date
    Sep 2004
    Dallas, TX
    got the answer.

    i should not put the set frm.recordset = rs

Posting Permissions

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