Now that our database is fully populated with the records it's time to talk about ways we
can look at, or analyze, our data.
Sorting is one very basic way to look at the data.
You sort data every single day.
For example, A calendar sorts appointments and activities or tracks birthdays by date;
email can sort by who sent the email, the date it was received, or the subject, and
Excel spreadsheets sort data, too.
Access lets you sort your records based on any value or field from which you'd like to
pull out specific information.
We enter new books into the database as we get them into our store which means they are
not in any kind of order they aren't stored alphabetically by title or author, and they
aren't grouped according to their category.
So how do you make them appear in some sort of useful order?
Let's say we want to see what categories of books we have.
We could scroll through the Books table to see each record and note the category of each
one, but that could take a long time if we had hundreds or thousands of books in our
database.
Instead, we can sort the records based on the category field so that all the records
for a particular category are grouped together for us.
Now, we can do this in the Books table, or using the Books form.
First, let's look at sorting a text field; we'll start by sorting the Category field
in the Books table.
You could do this from the Ribbon using one of the Sort commands on the Sort & Filter
command group, or it is easier to click on the arrow at the top of the Category column.
This brings up some options - the same options you have in the Ribbon.
The first two are your sorting options.
The bottom options are filtering options.
We'll cover these in another lesson.
You can sort this text column alphabetically, from A to Z or from Z to A.
Now, when you want to clear the sort, you have to do that from the Ribbon with the Clear
All Sorts command - the one with the little eraser icon.
Let's sort on a numerical field this time let's sort our books by price if we wanted
to see what books are our most expensive, for example.
Select the drop down arrow at the top of the Price column.
You get a few options here, too, just like you did when we sorted on category.
But, notice that the sort options are now numerical.
That is because this field was set up with a data type of currency, which is a numerical
value.
We get to decide what order we want, smallest to largest, or largest to smallest.
Let's choose largest to smallest, so the most expensive book appears first for each category
grouping.
What if we want to do a multi-level sort like you can do in Excel?
Well, Access can do a multi-level sort, but the results can turn out very differently
than you expect, so we recommend that if you want to sort based on more than one field,
that you either do an advanced filter which we'll cover in the next lesson or write a
query for that.
We'll get to both filtering data and queries in later lessons.
Sorts pull some very basic information out of your database for you.
Our next lesson will show you how to filter the data in a table.