Home

Characteristics of Reports

 

Characteristics of Sections of a Report

 

The Background Color of a Section

By default, each section of a report appears white so its background would print as transparently as possible on a white piece of paper. If you want, you can change the background color of any section. To change the color of a section:

  • You can right-click the section or its bar, position the mouse on Fill/Back Color, and select a color from the window
  • You can click a section or its bar. Then, in the Font section of the Design tab of the Ribbon, click the arrow of the Fill/Back Color button and select the desired color from the window
  • You can double-click the section or its bar to access its Properties window. Then, in the Format or the All tab of the Properties window, click Back Color and select the desired color

If you specify the background color other than white for a section, you should set the same background color for the controls in that section.

Practical Learning: Setting the Background Color of a Section

  1. Start Microsoft Access and, from the resources that accompany our lessons, open the Bethesda Car Rental1 database
  2. To create a new report, on the Ribbon, click Create and, in the Report section, click Report Wizard
  3. In the Tables/Queries combo box of the first page of the wizard, select CarsCategories if necessary.
    In the Available Fields list, double-click Category, DailyRate, WeeklyRate, MonthlyRate, and WeekendRate
     
  4. Click Next, Next, and Next
  5. Make sure the Tabular radio button is selected and click Next
  6. Select the Civic style and click Next
  7. Change the title to RentalRates and click Finish
  8. Right-click the title bar of the report and click Design View
  9. Click Page Header
  10. On the Ribbon, click Design if necessary.
    In the Font section, click the arrow of the Fill/Back Color button and select Maroon (Standard Colors: 1st row - 6th column)
  11. On the report, right-click the Detail bar, position the mouse on Fill/Back Color, and select Brown 4 (5th row - 10th column)

The Alternate Background Color of a Section

If you create repeating colors on a report, you can make the other occurrence of a section show a different color. This means that you can make every odd occurrence show a certain background color and every even occurrence to show a certain background color. This is referred to as alternating the colors.

To apply the color alternating feature, first select a section and set its background color using the Fill/Back Color button. Then:

  • While the same section is selected, in the Font section of the Design tab of the Ribbon, click the arrow of the Alternate Fill/Back Color button Alternate Fill/Back Color and select a color
  • While the same section is selected, in the Format or the All tab of the Properties window, click Alternate Color, then click the arrow of its combo box and select the desired color
  • Right-click the section or its bar, position the mouse on Alternate Fill/Back Color and select the desired alternate color

Here is an example of the type of result you could get:

Alternate Fill/Back Color

Practical Learning: Setting the Alternate Background Color of a Section

  1. Right-click the Detail bar, position the mouse on Alternate Fill/Back Color, and select Brown 2 (3rd row - 10th column)
  2. Right-click the title bar of the report and click Print Preview
  3. Save and close the report

Report: Rental Rates

Keeping a Section on its Own Page(s)

Consider the following design of a report:

If you create a report and design it with the default settings, the first record displays. If its values do not cover the whole page, the values of the next record start displaying on the same page but, if the next record cannot completely fit on that first page, it does not print on that page. Instead, it prints on the next page. This means that more than one record can print on the same page if and only if all those records can fit each completely on that page. In some cases, such as if you have a report that displays a type of magazine, brochure, or catalog, you may want the first record to print on the first page, when the first record finishes, print the next record on the same page. If both records have printed on the same page and there is still enough room, the next record could start. Once the first page is full, the values left from the previous record continue on the next page. As you may suspect, these two scenarios depend on the types of values that the report is asked to print and of course this highly depends on your intention.

The ability to keep each record on its own page is controlled by the Keep Together property of a section. To access it, display the report in Design View and double-click either the section or its bar. Keep Together is a Boolean property with a Yes and No options:

  • If you set Keep Together to Yes, which is the default value, the first record displays or prints its values on the first page:
    • If there is still room on that first page, Microsoft Access calculates how much room the next record needs. If the next record can completely fit on the remaining area of the first page, then that next record is put on that first page:
       
    • If the next record is too long to fit on that first page, it would not print on it but would be sent to the next page and the remaining area of the first page would be left empty:

      This evaluation is made for each subsequent record.

    • If the first record itself is too long to fit on the first page, it would print on the first page and would continue printing on the next page. Then, if the next record can fit on that second page (which is usually unlikely), it would be put on that page
  • If you set Keep Together to No, the first record displays on the first page, followed by the next record. If the record gets to the end of the page, it continues on the next page. This means that the records would simply continuously print one after the other:

A Report With Multiple Columns

All of the reports we have created so far display in one vertical list. Such a list is referred to as a column. If a report is made of a single list and the items of the list are not too wide, you can display the list in various columns.

To create the columns on a report, first make the list wide or narrow enough so it can fit more than once on the piece of paper. Then, display the Page Setup dialog box. In the Page Setup dialog box, set the Number of Columns text box to a value of your choice.

To display the items of the columns, you have two options. This option is set in the Column Layout section:

  • You can put the first item in the first column, the second item in the second column, the third item in the third column, and so on. When the list of columns is met, the items continue on the first column, followed by the subsequent columns. If you want this layout, select the Across, then Down radio button
  • You can put the first item in the first column, followed by the second item in the first column, followed by the third item in the first column, and so on. When the first column is filled, the list continues on the second column, then the subsequent columns. If you want to use this layout, select the Down, then Across radio button.

Practical LearningPractical Learning: Creating Multiple Columns on a Report

  1. Open the Red Oak High School database you created in Lesson 5 and continued in Lesson 19
  2. In the Navigation Pane, double-click the Students List report to open it in Report View
  3. Right-click the body of the report and click Design View
  4. Click the Office button, position the mouse on Print, and click Print
  5. On the Print dialog box, click Setup...
  6. In the Page Setup dialog box, click the Columns tab
  7. In the Grid Settings section, set the Number of Columns to 2
  8. In the Column Layout section, click
     
    Page Setup
  9. On the Page Setup dialog box, click OK
  10. On the Print dialog box, click Cancel
  11. To preview the report, on the Ribbon, click the arrow under the View button and click Print Preview
     
    Students
  12. Close the report
  13. When asked whether you want to save, click Yes

Introduction to Grouping Records

 

Overview

Consider the following table that represents a list of students:

Students

When creating this type of table, you may have values that can be considered in categories, such as sold and unsold items, discounted and not discounted items, or males and females. When preparing a report, you can show its records by each category. For example, on a table of students, you can show the list of girls only first. Then, after the group of girls, you would show the list of boys. This is referred to as grouping the records.

Practical Learning: Introducing Groups

  1. From the resources that accompany our lessons, open the Altair Realtors2 database
  2. To create a new report, on the Ribbon, click Create and, in the Report section, click Report Design
  3. Right-click the title bar of the report and click Save
  4. Set the name to Properties By Type and press Enter
  5. If the Properties window is not available, on the Ribbon, click Design and, in the Tools section, click Property Sheet.
    On the Properties window, click the Data tab, click Record Source, type p and press Enter

Creating a Group Header

To create a group of records on a report, you have various options. You can let the Report Wizard assist you or you can work manually. If you want to create the group yourself, first open the report in Design View and specify, or make sure, its Record Source has a table. Then:

  • On the Ribbon, you can click the Group & Sort button Group & Sort
  • Right-click somewhere on the report and click Grouping and Sorting

This would add a new section titled Group, Sort, and Total under the report:

Group, Sort, and Total

One of the buttons in the new section is titled Add a Group. To create a new group, you can click that button. This would change the contents of the window and display a new button with a popup window that shows the fields of the table specified as the Record Source:

From the popup window, you can click the name of the field you want to use as the group leader. Here is an example:

Selecting a Field for a Group

This would add a new bar and section to the report above the Detail bar. The bar of the new section would display the name of the field followed by Header. Here is an example:

Selecting a Group Leader

Also, under the report, the contents of the Group, Sort, and Total window would be changed into a new bar that displays the name of the field that was selected.

Practical Learning: Creating a Group

  1. In the Design tab of the Ribbon and in the Grouping & Totals section, click the Group & Sort button
  2. Under the report, click the Add a Group button
  3. In the window that appears, click Property Type

Designing a Group

After creating a group, you can add, or continue to add, the fields to the report. One of the most important, but not required, aspects of design is that you should add the field that holds the same name to the new section:

That way, when the report prints, the name of the group would show before the related records: remember that the report bars do not show on the printed paper. After adding the field in its section, you can add, or you can continue adding, the other fields. Those other fields should be added to the Detail section or the section under the group header. If you include their labels, these labels would show for each field:

Adding the Fields Under a Group

This can appear unprofessional or redundant to some eyes. A better alternative is to put the labels of those child fields in the section of the group header, and put the controls in the section under the group leader. Here is an example:

Grouping

Notice that, by default, the Detail section repeats to show each record related to the group leader. Therefore, another aspect of design is that you should provide room only as much as necessary for each related record. Here is an example:

Providing Just Enough Room

Then, when the report displays or when it prints, all related records would show appropriately:

When the report displays or when it prints, all related related would show appropriately

Still, if each record has some detail, such as a comment or a calculation you want to add, you can/should include it in the Detail section, probably under the other fields.

Practical Learning: Designing a Group

  1. Design the report as follows:
     
    Report Design
  2. Right-click the title bar of the report and click Print Preview
  3. Save, print, and close the report

Adding a Sub-Group to a Group

Consider the following table of a list of students:

A Table of Students

In a certain table, you may have records that can be categorized. Then, inside of each category, there may be a sub-category. When creating a report for such a table, you can create one group, then create another group inside of that group. You start the report as we described so far: display it in Design View and specify its Record Source. You also start the grouping as we saw above. In the Group, Sort, and Total window, click the Add a Group button and select the primary group. Here is an example:

In the Group, Sort, and Total window, click the Add a Group button and select the primary group

As mentioned already, a bar would be added to the Group, Sort, and Total section. Under that bar, there would be a new Add a Group button and a dotted curved line joining them:

A bar would be added to the Group, Sort, and Total section. Under that bar, there would be a new Add a Group button and a dotted curved line joining them

To create a sub-group, you can click the Add a Group button to display the list of fields and click a field from that list:

To create a sub-group, you can click the Add a Group button to display the list of fields and click a field from that list

A new section would be added under the main one and it would have the same name of the field that was added, followed by Header:

Notice that under the report, a bar for the new group is added and it has its own Add a Group button, which indicates that, if necessary, you can create another sub-section. You can continue the same approach to create as many sub-sections as you judge necessary.

When designing the report, in the main section, you should add only its own field. In the group under it, you should add the field of that group and the labels of the related records if that section does not have its own sub-group. Then, in the Detail section, add the last fields of the grouping:

 
 

Removing a Group

If you have a group you do not like on a report, you can get rid of it. To remove one group, under the report, click the Delete button that corresponds to it. You would receive a warning so you can make your final decision. If you delete a sub-group, only its section would be removed from the report. If you delete a group that has one or more sub-groups, its section and its sub-sections would be removed from the report.

The Characteristics of a Group

 

Forcing a New Page

When creating a report, you add the fields of the records as you see fit in the desired sections and groups. As seen with the Keep Together Boolean property, you can exercise some control on how many records print on one page based on the number of fields of each record. We saw that if many records could fit on one page, then they would be grouped on that one page. In some cases, you may want each record on its own page, even if the record has only a few values, even if many records can fit on one page. Displaying each record on its own page is referred to as forcing a new page.

The ability to force each record on its own page is controlled by the Force New Page enumerated property. To use it, access the Properties window for a section or group. From the Format or the All tab, click Force New Page, and click the arrow of its combo box to display the list of options:

  • None: This is the default value and simply specifies that the record will print on the page
  • Before Section: The section or group will print in the top section of a new page and the rest of the page could be left empty. The next section or group would print on the next page:
     
     
    If you create a report with various groups, probably the best way to use the Before Section option is to apply it on the first or main group. This would display each record on its own page
  • After Section: This section or group will print on this page. Then the section or group after this one will print in the top section of the next page
  • Before & After: This section or group will print in the top section of this page. Then the section or group after this one will print in the top section of the next page

Practical Learning: Creating a Catalogue

  1. The Altair Realtors2 database should still be opened.
    On the Ribbon, click Create.
    In the Reports section, click Report Design
  2. Using the Properties window, set its Record Source to Properties
  3. Right-click the report and click Report Header/Footer
  4. Save the report as Real Estate Catalogue
  5. Widen the report up to 8
  6. Increase the height of the Report Header section down to 10.50
  7. Increate the height of the Detail section down to 9.50
  8. Increase the height of the Report Footer section down to 3.50
  9. Design the report as follows:
     
    Altair Realtors
    Altair Realtors
    Altair Realtors
    Altair Realtors
    Altair Realtors
  10. Save, preview, print, and close the report

Lesson Summary

 

MCAS: Using Microsoft Office Access 2007 Topics

C6 Create reports
C7 Modify the design of reports and forms
 

Exercises

 

Yugo National Bank

  1. Open the Yugo National Bank database
  2. Create a new report for the TransactionTypes table and make the detail section alternate colors between White and Light Blue 1

Watts A Loan

  1. Open the Watts A Loan database
  2. Create a new report for the Types of Loans table and make the detail sections alternate colors between White and Brown 2

World Statistics

  1. Open the World Statistics1 database
  2. Create a report catalogue for the Countries table

US Senate

  1. Open the US Senate1 database
  2. Create a report catalogue of the senators, one senator per page
 

Previous Copyright © 2008-2012 FunctionX Next