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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top 10 Based on an Average!

Status
Not open for further replies.

proximity

Technical User
Sep 19, 2002
132
GB
Hi,

I have a field called txtPerformanceAverage on a report, which is calculated thus: =Avg([Performance]). How do I get it to display the top 10 results????

Any help more than gratefully received!
 
Do it in the query and set the query RecordSource of the report

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Do you want to display on the top 10 averages or do you want to display the details and the averages of the top 10?

If I understand correctly, you can create a totals query that groups by your grouping in your report and averages Performance.
For instance in the Northwind, if you wanted the 10 customers with the highest average freight in the Orders table:
Code:
SELECT TOP 10 Orders.CustomerID, Avg(Orders.Freight) AS AvgOfFreight
FROM Orders
GROUP BY Orders.CustomerID
ORDER BY Avg(Orders.Freight) DESC;
Save this query and add it to the record source of your report and join the field equivalent to CustomerID.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top