Results 1 to 7 of 7

Thread: Dll returned a Rs. Now what?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Smile Dll returned a Rs. Now what?

    My Dll returns me a recordset in the form of a variable. How do I now use the records from the rs to populate my listview? Is there a special way to declare a variable to be a rs?

    Code:
    Private Sub Command1_Click()
    Dim rs As GRSrch.rs
    Set rs = New GRSrch.rs
    Dim conn As GRSrch.Connection
    Set conn = New GRSrch.Connection
    Dim rsRecordset As Recordset
    
    conn.GetConn2
    
    If rs.Get_Search_RS(rsRecordset, Text1.Text, Text2.Text, Text3.Text, Text4.Text) = 1 Then
        MsgBox "No record found"
    Else
        MsgBox "record found"
    End If
    
    conn.CloseConn
    
    End Sub

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    For example:
    Code:
    Option Explicit
    m_objRS as ADODB.Recordset
    
    '// All I am doing is passing my connection object to my class
    '// Method and setting a recorset object to the return value.
     Set m_objRS = objSelect.GetAllStates(m_objConn)

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    I get an error because my arguments are not optional. I didn't think of that when I built the function.

    Any ideas?

    Code:
    Private Sub Command1_Click()
    Dim rs As GRSrch.rs
    Set rs = New GRSrch.rs
    Dim conn As GRSrch.Connection
    Set conn = New GRSrch.Connection
    Dim rsRecordset As ADODB.Recordset
    Dim rsReturnRS As ADODB.Recordset
    
    conn.GetConn2
    
    If rs.Get_Search_RS(rsRecordset, Text1.Text, Text2.Text, Text3.Text, Text4.Text) = 1 Then
    '    sMsgBox "No record found"
    Else
        Set rsRecordset = rs.Get_Search_RS(rsReturnRS) 
        MsgBox "record found"
    End If
    
    conn.CloseConn
    
    End Sub

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    You should be passing a connection object, not a recordset object.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    forgive me for my ignorance but I dealt with the conn object in the dll already by declaring it in a standard module.
    All I want is the rs to use to populate a control.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    ok I passed the connection object but I still get an error saying Type mismatch on the red. I changed the dll to accept the conn object. But what does that do?

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim rs As GRSrch.rs
    Set rs = New GRSrch.rs
    Dim conn As GRSrch.Connection
    Set conn = New GRSrch.Connection
    Dim rsRecordset As ADODB.Recordset
    Dim rsReturnRS As ADODB.Recordset
    
    conn.GetConn2
    
    If rs.Get_Search_RS(conn.conn2, Text1.Text, Text2.Text, Text3.Text, Text4.Text) = 1 Then
       MsgBox "No record found"
    Else
        Set rsRecordset = rs.Get_Search_RS (conn.conn2, Text1.Text, Text2.Text, Text3.Text, Text4.Text)
        MsgBox "record found"
    End If
    
    conn.CloseConn
    
    End Sub
    Last edited by jesus4u; May 2nd, 2001 at 01:56 PM.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    changed the client and dll to reflect a return rs

    Code:
    If rs.Get_Search_RS(conn.conn2, rsReturnRS, Text1.Text, Text2.Text, Text3.Text, Text4.Text) = 1 Then
       MsgBox "No record found"
    Else
        Set rsRecordset = rs.Get_Search_RS(conn.conn2, rsReturnRS, Text1.Text, Text2.Text, Text3.Text, Text4.Text)
        MsgBox "record found"
    End If
    Still the same error as before.
    I guess I don't underastand how to pass variables and retrieve them properly.

    ugh!!!

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