How can I limit records in my report to the most recent date?

G

Guest

I have multiple records with multiple barrels and multiple dates. How can I
limit the records appearing in my report (from a Query) to one record with
the most recent date? Thank you! Greg
 
G

Guest

Sort your data by the date Desc, so the most recent record will be on top,
and then add to the query Top 1

Select Top 1 TableName.* From TableName Order By DateField Desc
 
F

fredg

I have multiple records with multiple barrels and multiple dates. How can I
limit the records appearing in my report (from a Query) to one record with
the most recent date? Thank you! Greg

Set the Filter property of the report to:
[DateField] = DMax("[DateField]","QueryName")
Set the Report's FilterOn property to Yes.

Or..
Create another query based upon your current query.
Set the datefield's criteria to
DMax("[DateField]","QueryName")

Use this new query as the report recordsource.
 
G

Guest

Thank you both very much for your quick and illuminating responses!

I had some trouble implementing the response from Ofer that recommended the
use of "Top1". When I used fredg's advice, I was able to reduce my report to
one record, the most recent. But upon rereading my question I realize I
didn't describe it accurately.

I have some 90 entries in my query coming from two tables. I want my report
to use the query proceeds to group only the most recent entry for each of 23
barrels, with most of them having different "recent/last" dates.

Thank you again. Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top