Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

query - max ID number

 
   Database Help (Home) -> MS Access RSS
Next:  SQL 2005, is there a way to determine whether a s..  
Author Message
Pass-the-reality

External


Since: Jan 23, 2008
Posts: 30



(Msg. 1) Posted: Wed Dec 31, 2008 8:18 am
Post subject: query - max ID number
Archived from groups: microsoft>public>access (more info?)

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

 >> Stay informed about: query - max ID number 
Back to top
Login to vote
Rick Brandt

External


Since: Nov 17, 2008
Posts: 66



(Msg. 2) Posted: Wed Dec 31, 2008 12:26 pm
Post subject: Re: query - max ID number [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Wed, 31 Dec 2008 08:18:12 -0800, Pass-the-reality wrote:

> 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.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

 >> Stay informed about: query - max ID number 
Back to top
Login to vote
John Spencer

External


Since: Nov 15, 2007
Posts: 91



(Msg. 3) Posted: Thu Jan 01, 2009 4:51 pm
Post subject: Re: query - max ID number [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
'====================================================


Pass-the-reality wrote:
> 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
 >> Stay informed about: query - max ID number 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Row Number in Query of Query - I've seen messages in the group, most recently last month, about adding row numbers to a query. I'm looking to do the same but with a twist - I've already sorted the data and have it in a query with no single unique key field. I'll give you my reasonin...

Ascending number in query - I have an access query which gets data from a number of different tables. Although the tables have primary key fields, the order in which the records are returned means that none of these are in ascending order in the query result set. I need to include....

Number of records in a query. - How do I find out how many records are in a query using VBA codes?

Query Number Of Character - I hv this sample of record in my ID field. ID A12345 777777777777 L324554 Q. How to query those ID which is less than 10 character? TQ

number of columns in a query - Hi, my query is full, but I need more columns. Is there a maximum numbers of columns you can have? On a similar note, say I was to "cut" columns from the design of my query, how would I then "insert" more columns? Thanks Kate
   Database Help (Home) -> MS Access All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]