Passing current ADO Record to another function Passing current ADO Record to another function vba vba

Passing current ADO Record to another function


Personally, I would pass the entire recordset in to the ProcessRecord subroutine. Recordsets are always passed by reference so there is no overhead (performance or memory consumption) passing a recordset around. Just make sure you don't move to the next record in the ProcessRecord subroutine.


you can use the GetRows() method to load the data into an array and then let ProcessRecord work only with the array, but that 'disconnects' the method from the dataset and this may not be what you intend.

The GetRows() method takes optional arguments to specify how many rows to get, where to start and the fields to get

So:

ProcessRecord(data.GetRows(1,adBookmarkCurrent))

should do it for all fields


Unfortunately no.. you cant extract a single Record from a Recordset.. as G. Mastros said there is no additional overhead passing the whole recordset by reference and work with the current record so you might as well do it like that