query - max ID number

P

Pass-the-reality

I have a query that returns all the records with today's date. Within the
query, I also return all the record Auto ID numbers. What do I need to add
to this query so that it will only return the max auto ID number. For
example - I only want line 1235 to show as it is the largest ID number.

ID Date
1233 December 31, 2008
1234 December 31, 2008
1235 December 31, 2008
 
R

Rick Brandt

I have a query that returns all the records with today's date. Within
the query, I also return all the record Auto ID numbers. What do I need
to add to this query so that it will only return the max auto ID number.
For example - I only want line 1235 to show as it is the largest ID
number.

ID Date
1233 December 31, 2008
1234 December 31, 2008
1235 December 31, 2008

Sort by ID (descending) and then set the query to return the Top 1
values. This is found in the query property sheet.
 
J

John Spencer

SELECT Max(ID), Table.[Date]
FROM Table
WHERE Table.[Date] = Date()

By the way terrible name for a field. Date is a function returning
today's date (or at least the system date on your computer)

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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