Reputation: 51
I have written a Shared Add In using VS 2008 which contains a public method that returns an ADO Recordset. In MS Access I would like to set a ADO Recordset to the return of the function call. The function call executes fine when calling the COM object. However assigning a ADO Recordset in VBA to the function returns a "Compile error: Invalid use of Property" . What am I doing wrong?
Dim result As ADODB.Recordset
result = .Object.doSomething(parameter1, parameter2)
Upvotes: 2
Views: 482
Reputation: 97100
Use the Set
keyword when assigning to an object variable.
Dim result As ADODB.Recordset
Set result = .Object.doSomething(parameter1, parameter2)
Upvotes: 1