Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bottom N Records Per Group 1

Status
Not open for further replies.

tripsma

Programmer
Dec 6, 2002
2
US
Does anyone know how to get the "Bottom" N records instead of the Top N in MS Access per group? I know you can set the properties in a query to get the Top N records, but I need the Bottom N records (like the 1st 6 records per group, for example).

Does anyone know how to pass a value (based on a column from a table) for the "N" either via code or a query?
 
yeah, you can do two things
1) make a query for the top then then make a second query, querying the table that is NOT in the top. Meaning, if you have 600 records and you want the bottom 10, make first one top 590, and the second one is the results that are in your table and not in your first query.

2)
the following:

use code to .movelast and .moveprevious to cycle backwards from the bottom of your selected table/query


hope this helps. If you get stuck, i can give more detail Cruz'n and Booz'n always.
This post shows what little I do at work.
 
Thanks!!! I'll just get a count of the records per group, so I'll know how many to query for the Top N records, then get those records not in the list.

Thanks for your help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top