Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Access's way of preparing material and data for the printed page is through the report object. Reports take data from tables and queries, applies formatting and organization rules, and bundles all of it together into documents that are ready to be sent to a printer or a PDF file, for example. In this movie, we're going to take a look at how Access organizes data into grouping and sorting levels. If you've ever used the totals row within a query, this may seem somewhat familiar, as the concept is really similar. Let's get away from the Olive Oil Company for just a moment and we're going to take a look at a database that's all about playing cards.
I'm going to double-click on this table here called Draw. We can see that this table has 5000 total records at the bottom here, and we have a listing of randomized cards. Basically, I took a random card from a deck of cards and I made a record of each pull. So, for the first pull I had 6 of Hearts, on the second pull I had 4 of Clubs. Let's go ahead and close the table and we'll take a look at a summarized look using this query here, DrawResults. I'll double click on the query and we see that this query is counting up the number of times each card appeared out of the total 5,000 draws. My Queen of Diamonds for instance, had 121 showings, the Four of Clubs appeared 118 times, and if I scroll to the bottom here, I can see that the Six of Hearts showed up the fewest number of times in my random drawings at 76.
Now, this is the data that we're going to use to build a report off of. Let's go ahead and close the query, but I'll keep it selected over here in the navigation pane. I'll go to the Create tab, in the Report section we'll click on the Report button. Access will create a very simple report for us based off of the data in that query. Now, the default layout with all the records alphabetized doesn't really allow for a detailed understanding of our data. For instance, looking over this report could you tell me which card appeared most often or how do the King of Clubs rank out of all of the Club cards? This report is not organized very we'll at the moment; it can't even help us to answer these very basic questions.
We can fix that using the Group & Sort options to better understand the layout. We can turn on Grouping & Sorting and the Grouping & Total section of the Design ribbon. Press this button here and we'll see a new window up here at the bottom. Inside of this window we have two options. We can either Add a group or Add a sort. Let's start by adding a sort. I'll click on Add a sort and then Access asks me which value I want to sort on. Let's go ahead and sort on the CountOfID that's the number of times it appeared. I can also choose to sort it from smallest to largest or using the drop down, I can change it to largest to smallest. Now, I can see which card appeared the most times.
We can also use the Grouping & Sorting to group like values together. Let's go ahead and delete this sort right now, using the X on the far edge of the bar. This time I'll Add a group, and let's say we want to group all of the cards together by color, so that all the black cards are together, and then all of the red cards appear together. I can choose SuitColor. Now, I can see in my report, I've got black here at the top and then all my black cards, the Spades and Clubs, and if I scroll down, I'll find the Red cards, and then that's where the Hearts and Diamonds are. Now, within this grouping, we can add an additional grouping.
Right now we've got a group for Red color. Let's add another group below that by Suit. We'll add a group down here at the bottom, we'll say SuitName. Now, we'll start at the top of the report. I've got Black Clubs, there are all my Club cards, and I'll scroll down, then my Spade cards, here they are. Scrolling down further, I get to the Red section with Diamond startingm and scrolling down further, there're my Heart cards. Now, within that we can add a sorting, so we can sort them ascending or descending by the value that they appeared. We'll Add a sort now, we'll say CountOfID at this point and we'll change it again to from largest to smallest.
So, now they're ranked in order, but grouped by suit name and suit color. Now, let me take a look at this report in Print Preview mode. We'll switch our view here at the top, we'll click the down arrow and we'll choose to go to Print Preview mode. In Print Preview I can scroll through the report and see what it looks like. Now, when I get to the bottom of the page here, I notice that my Red section actually starts here, but the vast majority of that data is on page number 2. I'll select this button to change our page and I'll scrub and this is the rest of the Red data. I can use our Grouping & Sorting levels to help control where the page breaks fall for my report.
If I close Print Preview, it will take me back to Layout View and here on Group on SuitColor, I can click the More button right here, and one of the More Options that I have is do not keep group together on one page. I can change that to keep whole group together on one page. Now, if I go back to Print Preview and take a look at it, I can scroll down, here's my Black Club cards, scrolling down, here's Spades. I get to the bottom of that and I don't have the Red cards anymore. I actually have to go to page 2 and up at the top to get to the Red Diamonds and Hearts.
So, understanding grouping and sorting behavior within your reports is key to creating documents that deliver the information needed in the most organized manner possible.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 70074 Viewers
80 Video lessons · 127448 Viewers
52 Video lessons · 62386 Viewers
59 Video lessons · 48090 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.