LastQueryResults Property

       

Returns a reference to the rdoResultset object generated by the last query – if any.

Syntax

object.LastQueryResults

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Return Values

The LastQueryResults property return value is an object expression that specifies a valid rdoResultset or Nothing if there is no result set available.

Remarks

This new property will contain a reference to the rdoResultset object generated by the last query executed on this connection, if any. The necessity of this property comes from the Queries as Methods feature, allowing the developer to call their queries and stored procedures as methods of the parent connection object. Since stored procedures can pass back a return value as well as resultsets, the developer needs this property in order to get a reference to the result set created during the last query as method call. The developer would use this property as shown below:

Dim RetCode As Long
Dim rs as rdoResultset
RetCode = MyConnection.MyQuery(x,y,z)
Set rs = MyConnection.LastQueryResults

This property is set back to “Nothing” on the next query execution on the connection. This property will be set for any query executed on the connection, even if the developer used the OpenResultset or Execute methods instead of calling the query as a method of the connection object.