If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Filtering in reports

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-13-06, 06:10
Databaseman Databaseman is offline
Registered User
 
Join Date: Mar 2005
Posts: 55
Red face Filtering in reports

I have a report based on a query which i have grouped by

State, business unit then employee

I only need the top 20 employees for each business unit,,,how do i go about displaying only 20 records in each group

I know how to use the top values query to get the 20 values for the whole report, but in this instance i need the top 20 values for each group
Reply With Quote
  #2 (permalink)  
Old 09-13-06, 10:03
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
One way (just a suggestion - others might have a better suggestion) is to do it by opening a recordset in vba with a select statement that orders it descending for the field you want and then do a loop of 1 to 20, opening another recordset and appending to a "temp table" which the report is then based off of.
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On