Help a Newbie Out

lewando_bria

BoRiS
Local time
Today, 11:08
Joined
Jun 18, 2002
Messages
29
hey what's up...i've been using access for almost a week now...i am trying to create a query that will return just the information associated with the record with the highest "Item #"...just wondering how to do this...i'm not sure if i gave enough information but like i said i am new to this...any help would be greatly appreciated...
 
Right-click in the top part of your query and go to Properties.

You want to change the Top Values property to 1.

Now change the Sort order for your query to Descending, based on the [ItemNum] field. Run your query and you should get one result, with the highest ItemNum existing.
 
If the query is to find the highest valued item from a list, you can do this any number of ways. But don't forget that, unless the field in question is a primary key or indexed-no-duplicates field, you might still get back more than one record.

One way to do this from a query is to define a criterion in a standard SELECT...

In the query grid, if [MyItem] is the numeric thing for which you wanted to find the highest value and return the associated record,

First column of query grid:

Field: [MyItem]
Table: [MyTable]
Sort: (none)
Show: [x]
Criteria: =DMax( "[MyItem]", "MyTable" )

All other columns of the query grid would contain the other fields you wanted returned from this query.

This isn't always the best method, but for some folks it is the easiest to see.
 

Users who are viewing this thread

Back
Top Bottom