Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 18: Advanced Access Query Techniques


645


Suppose that you want to identify the first 10 customers for 2012 — in other words, the first 10
sales of the year 2012. This is known as the top (n) records. Follow these steps to determine the
first (top) 10 sales for 2012:


  1. Create a new query using tblCustomers and tblSales.

  2. Enter Between 1/1/2012 and 1/1/2013 as the criteria in the SaleDate field.


Access automatically surrounds the dates with pound signs. You can, if you want, add the
pound signs yourself as you enter the query’s criteria.



  1. Specify Ascending as the sort order for SaleDate.

  2. Enter 10 in the Return box in the Query Setup group on the Design ribbon tab. (You
    could select another value such as 5 or 25 from the drop-down list, if desired.) Figure
    18.9 shows the design of this query.


FIGURE 18.9
A query returning the first ten sales of the year

Criteria restricts results to 2012

Number of records to return
Free download pdf