[AccessD] Most efficient means to retrieve most recent record

William Benson (VBACreations.Com) vbacreations at gmail.com
Thu Jun 2 19:12:00 CDT 2011


Hello,

In an Access table where I import and append very similar data routinely, I
stamp every record with the same ImportTime at time of import. 

I am wondering the most efficient means of getting at the latest record
matching certain criteria?  I see three ways. 


METHOD 1
   (1) Set a recordset = the entire table ordered descending, with no WHERE
clause
    (2) use Rst.FindFirst and put the criteria here as arguments 


METHOD 2
   (1)  Use an ORDER BY (desc) clause, select all the records
     where those fields have the values I specify
   (2) Use the first record in the recordset.

METHOD 3
   (1) Select the max date where those fields have the values I specify
   (2) Select "the" record where those fields have the values I specify 
     AND
     Date = Date found from (1)   .... to me this seems unlikely to be
fastest, but who knows.




More information about the AccessD mailing list