/en/access2010/working-with-forms/content/
Access 2010 gives you the ability to work with enormous amounts of data, which means it can be difficult to learn anything about your database just by glancing at it. Sorting and filtering are two tools that let you customize how you organize and view your data, making it more convenient to work with.
In this lesson, you'll learn how to sort and filter records.
We will be showing you how to sort and filter records with examples from our sample database. If you would like to follow along, download our example and use it to follow the procedures demonstrated in this lesson.
Essentially, sorting and filtering are tools that let you organize your data. When you sort data, you are putting it in order. Filtering data lets you hide unimportant data and focus only on the data you're interested in.
When you sort records, you are putting them into a logical order, with similar data grouped together. As a result, sorted data is often simpler to read and understand than unsorted data. By default, Access sorts records by their ID numbers. However, there are many other ways records can be sorted. For example, the information in a database belonging to a bakery could be sorted in several ways:
You can sort both text and numbers in two ways: in ascending order and descending order. Ascending means going up, so an ascending sort will arrange numbers from smallest to largest and text from A to Z. Descending means going down, or largest to smallest for numbers and Z to A for text. The default ID number sort that appears in your tables is an ascending sort, which is why the lowest ID numbers appear first.
In our example, we will be performing a sort on a table. However, you can sort records in any Access object. The procedure is largely the same.
Selecting a field by clicking on its title
The Ascending and Descending Sort commands
The same table, with an ascending sort applied to the Last Name field
Saving the sortAfter you save the sort, the records will stay sorted that way until you perform another sort or remove the current one. To remove a sort, simply click the Remove Sort command.
Removing the sort
Filters allow you to view only the data you want to see. When you create a filter, you set criteria for the data you want to display. The filter then searches all of the records in the table, finds the ones that meet your search criteria, and temporarily hides the ones that don't.
Filters are useful because they allow you to focus in on specific records without being distracted by the data you're uninterested in. For instance, if you had a database that included customer and order information, you could create a filter to display only customers living within a certain city or only orders that contain a certain product. Viewing this data with a filter would be far more convenient than searching for it in a large table.
In our examples and explanations, we will be applying filters to tables. However, you can apply filters to any Access object. The procedure is largely the same.
Selecting a field to sort by
Setting the filter to only show records with "Cary" in the city field
The filtered table, now showing only the records for customers who live in CaryToggling your filter allows you to turn it on and off. To view records without the filter, simply click the Toggle Filter command. To restore the filter, click it again.
Removing the current filter with the Toggle Filter commandFiltering by selection allows you to select specific data from your table and find data that is similar or dissimilar to it. For instance, if you were working with a bakery's database and wanted to search for all products whose names contained the word chocolate, you could select that word in one product name and create a filter with that selection. Creating a filter with a selection can be more convenient than setting up a simple filter if the field you're working with contains many items.
Selecting text to filter for
The Filter by Selection command
Setting the filter to show only records that contain the selected word
The filtered table, now showing only records containing "chocolate" in the Product Name fieldYou can also create a filter by entering a search term and specifying the way Access should match data to that term. Creating a filter from a search term is similar to creating a filter from a selection.
When filtering text by entering a search term, you can use some of the same options you use when filtering by a selection, like Contains, Does Not Contain, Ends With, and Does Not End With. You can also choose from the following options:
Selecting a field to filter by
Selecting filter settings
Typing the term the filter will search for
The filtered table, now showing only records containing the word "party" in the Notes fieldThe process for filtering numbers with a search term is similar to the process for filtering text. However, different filtering options are available to you when working with numbers. In addition to Equals and Does not Equal, you can choose:
Selecting a field to filter by
Selecting filter settings
Typing the number to filter for
The filtered table, now showing only records for menu items costing $5 or lessSpecific types of numbers may include other filtering options. For instance, dates stored in numerical form (mm/dd/yy—e.g., 12/01/2010) include options to filter by periods of time.
Filtering by date
/en/access2010/designing-a-query/content/