Tom van Stiphout <to*****@no.spam.cox.net> wrote in
news:pj********************************@4ax.com:
On 5 Nov 2003 11:53:30 GMT, Lyle Fairfield
<Mi************@Invalid.Com> wrote:
Lyle, what is that .Collect method on a DAO recordset?
It doesn't seem to be documented anywhere.
-Tom.
Collect returns field values directly.
One can use a numerical index or the field name.
rst.Collect(5)
rst.Collect("SomeFieldName")
It seems to be the second fastest way of getting field values, after
declaration of a field, and the setting of that field to a field in the
recordset as:
Dim fld as DAO (or ADO) field
SET fld = rst.Fields(3) or rst.Fields("FieldName")
then
do something with fld.value. (Dimitri Furman pointed out that this was
faster when I suggested Collect might be fastest and after I wrote that
code.) I believe it's quite a bit faster than bang or dot using the default
property (value) or the recordset using the default field property.
Why isn't it documented? I don't know. I've been using it for years with no
problems. And I still use it for single retrievals of data. But when I'm
doing a lot of processing, say looping through a recordset 40 times, I use
the Dimitri method, that is I set the field object variables outside the
loop. This can have a dramatic effect on speed.
I'm wearing new glasses ... this may make no sense at all.
--
Lyle
(for e-mail refer to
http://ffdba.com/contacts.htm)