Presentation on theme: "Customizing Reports. Custom Reports A report is a formatted hardcopy of the contents of one or more tables from a database. Although you can format and."— Presentation transcript:
Custom Reports A report is a formatted hardcopy of the contents of one or more tables from a database. Although you can format and print data using datasheets, queries, and forms, reports allow you greater flexibility and provide a more professional, custom appearance. Reports can be used, for example, to print billing statements and mailing labels.
Report Sections An Access report is divided into seven sections. Although only the detail section is required, each report can contain any combination of the seven different sections or all of them.
Report Sections You don’t have to include all seven sections in your report. When you design your report, you determine which sections to include and what information to place in each section.
Sample report from the Restaurant Database Report Header Section Page Header Section Group Header Sections The Detail Section appearing for each group in the report.
Sample report from the Restaurant Database Report Footer Section Group Footer Sections Page Footer Section
Before you create a custom report, you should first plan the report’s contends and appearance.
Leonard has designed a custom report for us to create.
Report Footer Section
The Report window in Design view is similar to the Form window in Design view, which you used in the previous tutorial to customize forms.
In the design view, we can see the ToolBox button on the toolbar
Clicking this will produce the toolbox.
The page Header section is shown here!
The Detail section is shown here!
The Page Footer section is shown here!
To Create or get rid of a Page Header/Footer or Report Header/Footer section you can click View from the menu bar and click on the appropriate section option.
To create a calculated field on a report (or form) you must first be in the design view. UNBOUND Once in the design view, the first step is to create an “UNBOUND” text box that will be used for the calculated field. Conditional Values in Calculated Fields
To place an unbound text box in the report, we will use the Textbox tool on the tool box.
Conditional Values in Calculated Fields First, click on the tool to activate it and then release the mouse button.
Conditional Values in Calculated Fields Then position the pointer on the report where you would like the text box and again, click the mouse button.
Conditional Values in Calculated Fields This will place the Unbound text box on the report.
Conditional Values in Calculated Fields There are two way in which you can add a calculated conditional value text box to your report. The first way is to create a calculated field in an underlying query, as shown on page AC 6.06 in your books. Page AC 6.06
Conditional Values in Calculated Fields The second way is to add a calculation directly to an unbound field in the report.
Conditional Values in Calculated Fields To accomplish this, right click on the unbound text box (not it’s label) and select properties from the shortcut menu.
Conditional Values in Calculated Fields When the text box’s property window appears, click on the “All” tab and then right click on the “Control Source” property and select Zoom from the short cut menu.
Conditional Values in Calculated Fields This will zoom in to the control source property and will allow you more room for typing your expression
Conditional Values in Calculated Fields While in the Zoom Box, type the following expression. = IIF([Paid] is null,0,[InvoiceAmt]) Then Press the OK button.
Conditional Values in Calculated Fields This expression says: If the existing field named [Paid] in the underlying table or query is null (blank) then place a zero in this field, otherwise (else) place the value of the invoice amount for this record here. = IIF([Paid] is null,0,[InvoiceAmt])
Conditional Values in Calculated Fields Don’t forget the “=“ sign. This is not needed in a Query but is necessary when typing the expression in the control source of a text box on a form or report. = IIF([Paid] is null,0,[InvoiceAmt])
Conditional Values in Calculated Fields The IIF Function, referred to as the “Immediate IF” function, lets you assign one value to a calculated field if a condition is true, and another value if the condition is false. = IIF([Paid] is null,0,[InvoiceAmt])
You add bound controls to a report in the same way that you add them to a form. Adding Fields to a Report
Reference Window All Fields Adding All Fields to a Report Display the report in the design view Click the field list button on the Report Design tool bar to display the field list. To place all fields in the report, double click the field list title bar to highlight all fields, then click anywhere in the highlighted area hold and drag the fields to the desired section of the report. Release the mouse button when the fields are in position. Page AC 6.08
Reference Window A Single Adding A Single Field to a Report Display the report in the design view Click the field list button on the Report Design tool bar to display the field list. To place a single field in the report, position the pointer on the field name in the field list, and then click, hold and drag the field name from the field list to the report. Release the mouse button when the pointer is correctly positioned. Page AC 6.08
By clicking the field list button on the tool bar we can view the fields in the underlying table or query.
The field list
We have the option of clicking on the Field List Title bar to select all fields and then click, hold and drag any one field to the detail section. This will insert all fields.
Or, we can click, hold and drag one field at a time to the detail section, selecting only certain fields, instead of all fields.
Notice the labels connected to each field.
If we select a label, or all labels (without the text box) we can cut these to the clipboard.
This will remove them from the detail section, leaving the text box only.
Clicking anywhere in the Page Header Section or on the Page Header Bar will select the Page Header. We can then paste the labels into this section.
Moving and resizing controls is identical to that of forms. This is covered on page AC 6.11 in your books.
Changing the Caption Property Each label has a Caption property that controls the text displayed in the label.
Changing the Caption Property The caption property for an object determines the text displayed for that object.
The default Caption property value for a bound control is the field name followed by a colon. Other controls, such as buttons and tab controls, have Caption properties as well.
You can change the value of a Caption property for an object by using the property sheet for that object. You should change the Caption property value for an object if the default value is difficult to read or understand.
You can change the caption property for a label by 1. Right-click the label box to select it and display the shortcut menu 2. Click Properties to display the property sheet 3. Find the Caption Property 4. Type the new Caption 5. Click the Close button to close the property sheet.
Aligning Controls You can align controls in a report or form using the Align command. This command provides options for aligning controls in different ways. For example, if you select objects in a column, you can use the Align Left option to align the left edges of the objects. Similarly, if you select objects in a row, you can use the Align Top option to align the top edges of the objects.
Aligning Controls The Align Right and Align Bottom options work in the same way. A fifth option, Align To Grid, aligns selected objects with the grid dots in the Report window.
Aligning Controls To use the Align Command, first, select the objects that you wish to align, then select Format from the Menu bar and then select Align.
Format Align Left Right Top Bottom To Grid
To preview the report, simply click on the Print Preview button on the Report’s Design toolbar.
To Zoom in and out you can use the Zoom buttons on the Report’s Print Preview tool bar, or...
... Just click in the preview section to Zoom In or Click there again to Zoom Out.
Clicking in the preview of the report or using the Zoom buttons on the tool bar changes the size of the page displayed in Print Preview.
Page AC 6.18 Quick Check Review
Let’s take a few moments to break up into discussion groups. Each group will discuss the quick check questions on page AC 6.18 in your books. We will then review the answers at the end of the discussion.
Quick Check Review Session 6.1 1) The ____________ function lets you assign one value to a calculated field if a condition is true and a second value if the condition is false.
Quick Check Review Session 6.1 Additional Question What is the IIF function referred to as?
Quick Check Review Session 6.1 2) Describe the seven sections in an Access report.
Quick Check Review Session 6.1 3) What is a custom report?
Quick Check Review Session 6.1 4) What does the Report window in Design view have in common with the Form window in Design view? How does it differ?...
Quick Check Review Session 6.1 5) What is the Caption property for an object and when would you change it?
Quick Check Review Session 6.1 6) How do you left-align objects in a column?
Quick Check Review Session 6.1 7) What is the purpose of the Zoom button in Print Preview?
Your task today is to complete the exercises in Tutorial #6 Page AC 6.4 through Page AC 6.18 The disk is Level 2 Disk 1