user1738628
user1738628

Reputation: 51

MS Access trying to set ADODB recordset to return from com object

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

Answers (1)

HansUp
HansUp

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

Related Questions