-
I am trying to write a function that will return a recordset:
Property Get QueryResult() As Recordset
Dim ado as New Recordset
'Other declarations and execution of the query here
QueryResult = ado
End Property
The line 'QueryResult = ado' gives me an error: 'Inalid use of Property'. Can someone tell me how I can pass this recordset as a variable ?
Thanks
-
Since Recordset is an OBJECT, you have to change property from Get to Set. So your property would look like this:
Code:
Property Set QueryResult() As Recordset
Dim ado as New Recordset
'Other declarations and execution of the query here
Set QueryResult = ado
End Property