lenin
Feb 23rd, 2000, 04:48 PM
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
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