Criteria for Max date

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Access 2003

how do I write criteria in a date field column to return the record with
the most current (latest) date?

I tried using MAX - does not seem to give me what I want.

Thanks

dave
 
You need to use a subquery to return the desired value as the criterion.
Using generic names for fields and table (it's the same table and field that
you use in your original query):

(SELECT Max(T.NameOfDateField) AS MDF FROM NameOfTable AS T WHERE
T.PrimaryKeyFieldName = NameOfTable.PrimaryKeyFieldName)
 
Thank you. I will try that

Dave

Ken Snell (MVP) said:
You need to use a subquery to return the desired value as the criterion.
Using generic names for fields and table (it's the same table and field
that you use in your original query):

(SELECT Max(T.NameOfDateField) AS MDF FROM NameOfTable AS T WHERE
T.PrimaryKeyFieldName = NameOfTable.PrimaryKeyFieldName)

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
 
Back
Top