Find the oldest date in an Access recordset

  • Thread starter Thread starter gab1972
  • Start date Start date
G

gab1972

I found some coding to find a date range in an Access recordset, but I
need a macro to search a recordset for the oldest date.

Any help or references would be greatly appreciated...or even a place
to start. My recordset name is rs.

Thanks in advance! I love this community. It's saved my a$$ numerous
times.
 
Why not just have a sql query do it for you.
SELECT Max(Field_Name) AS MaxofField_Name FROM Table_Name;
 
Why not just have a sql query do it for you.
SELECT Max(Field_Name) AS MaxofField_Name FROM Table_Name;

Is "Maxof..." a part of the equation? My recordset name is
permit_info and the field I'm trying to find the lowest date is
permit_log_date. I want it to find that smallest date and return the
value in permit_num in the same recordset.

I'm not sure how to do that last part, but is this how my sql
statement should look?

str = "SELECT Min(permit_log_date) AS Min of permit_log_date FROM
permit_info"

thanks in advance...
 
One other thing...can I add an AND statement in there?

The criteria should be that I need to find in the recordset
permit_info the permit number (field = permit_num) with the smallest
date (field = permit_log_date) and does not equal "Applicant" in the
field curr_location.
 
Back
Top