Results 1 to 2 of 2

Thread: Passing A Recordset from a Class

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254

    Post

    Hello,
    Can anyone tell me if it is legitimate to return a recordset from a class? Instinctively you would think this would be possible.
    I get "invalid use of property".

    Source Code below:

    Public Function SelectRecords(queryString As String) As ADODB.Recordset
    ' * ====================================================================== *
    ' * Take the query string created on the client interface *
    ' * and modify sql command in DE, return recordset to client. *
    ' * ====================================================================== *


    Dim lb_return As Boolean
    Dim lrs_results As New ADODB.Recordset

    '
    ' Assign the string to existing SQL
    '
    deUSD.Commands("commForm_QueryCriteria").CommandText = queryString

    '
    ' Check state of Recordset
    '
    If deUSD.rscommForm_QueryCriteria.State = ADODB.adStateOpen Then
    deUSD.rscommForm_QueryCriteria.Close
    End If
    '
    ' Call the command with amended SQL statement
    '
    Call deUSD.commForm_QueryCriteria
    Set lrs_results = deUSD.rscommForm_QueryCriteria

    MsgBox lrs_results.RecordCount

    SelectRecords = lrs_results


    End Function

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284

    Post

    I think what you need to do is simply change your last line of code to


    Set SelectRecords = lrs_results


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