[AccessD] Find First in an Array?

Gustav Brock Gustav at cactus.dk
Thu Feb 19 11:59:06 CST 2009


Hi John

But why not just load the recordset as static when you initialize the class? Zero additional code, no fuzzing with collections etc.

/gustav

>>> jwcolby at colbyconsulting.com 19-02-2009 18:47 >>>
ICK!

This application is PERFECT for caching.  The data does not change from the time the database opens 
to the time it closes.  The data is loaded once into collections and then the form is loaded from 
its specific collection (class instance).  If you are going to run through the entire recordset 
every time the form opens... why not simply load the data into a collection the first time and let 
the poor disk take a nap?

This is not rocket science.  In fact if I hadn't had some calls from clients interrupt me it would 
be done already.

John W. Colby
www.ColbyConsulting.com 


Drew Wutka wrote:
> Hmmmm, actually, the way you have this set up, you could do this just
> fine without an array or collection.
> 
> Instead of this:
> 
> For Each ctl In frm
>     rstControls.FindFirst "fldLanguageForm = '" & argForm & "' and
> fldLanguageControl = '" _
>         & ctl.Name & "'"
> 
> Do this:
> 
> strSQL="SELECT fldLanguageControl, fldLanguage" & strLanguageToTranslate
> & " FROM tblYourTableName WHERE fldLanguageForm=""" & me.Name & """"
> set rs=New Recordset
> rs.open strsql,currentproject.connection, adopenkeyset,adlockreadonly
> if rs.eof=false then rs.movefirst
> do until rs.eof=true
> 	me(rs.fields(0).value).Caption=rs.fields(1).value
> Loop
> Rs.close
> Set rs=nothing
> 
> That way you are pulling the recordset up....and just running through it
> once...instead of trying to find every record based on the control.
> 
> Drew






More information about the AccessD mailing list