devxlogo

The hidden Collect method of the Recordset object

The hidden Collect method of the Recordset object

The ADO Recorset object exposes a hidden, undocumented member: the Collect property. This property is functionally similar to the Field’s Value property, but it’s faster because it doesn’t need a reference (explicit or implicit) to the Field object. You can use this property by passing a numeric index or a field’s name, as in:

Dim rs As New ADODB.Recordsetrs.Open "authors", "DSN=pubs"    ' reference by field's namefirstName = rs.Collect("au_fname")' reference by field's indexrs.Collect(2) = "John Doe"

Under ADO 2.5, the Collect property appears to be about 30% faster than the standard way to refer to a field’s value.

See also  Small Business Strategies with Venmo
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist