Previous Section Contents Docs Index


ACCESS-TU-1
Access Database: Tutorial Introduction


6. Reports


6. Reports

Although you can now display which courses each tutor has written, you could probably really do with a printed report with the relevant details. This can be created in a similar way to a form, with fields, controls, a header, a footer and a detail section.

6.1 Creating a Report

To provide the data that the report will contain, a table or query is needed. You have already created the Course Authors query which will give you the information you need.

To create the report:

> Click on the Report tab in the Database Window (Figure 2).

> Click on the New button.

> In the Select A Table/Query box, select Course Authors. This is the query that was created in the previous section.

> Click on the Blank Report button.

Although there are Report Wizards, using the Blank Report method allows more precise positioning of fields.

The blank Report Design window is shown in Figure 19.

Figure 19 - Report Design View

> Click on the Field List button in the toolbar. This will make a small window appear containing all the fields from your query or table.

You can now drag fields on to the three different parts of the report and change them, as in Forms Design View.

> Drag Tutor Name from the small Course Authors box to the blank Detail area (the white area underneath the grey band).

Don't worry too much about getting it in the right position at this stage - you can correct this later.

As with the Form created earlier, Access has automatically added a label in addition to the field, although here, on the Report, it's not as obvious which is which. (The left-hand one is the label, the right-hand one the field - check the Properties of the two boxes to verify this.)

For the simple list that this exercise will create, you don't need these identifying labels on every record. To remove the Tutor Name label:

> Click on the label box and press the [Delete] key.

Repeat the above process with the Course Name and Department fields.

Now that you have the fields you need on the Detail area, you can position them where you want them, and resize them if necessary.

> Click on the Tutor Name box, and drag it to the top left of the Detail area.

> Similarly, drag the Course Name field to the right of Tutor Name.

> You may want to enlarge the space allowed for the course name:
  • Move the mouse pointer over the right-hand "handle", until it changes to a double-headed left/right arrow.
  • Click and drag the edge of the box until it is as wide as you want.

> Finally, drag Department to the right of Course Name, and resize it if you want. (Don't worry if you drag off the right-hand edge of the Detail area - when you release the mouse button, it will automatically grow.)

Your screen should now look like Figure 20 (overleaf).

Figure 20 - Initial Design of Course Authors Report

At this point, it is probably a good idea to check how the printed report will look:

> Click on the Print Preview button .

The preview screen should be similar to Figure 21

> To return to design view, click on the Close Window button in the toolbar.

You can see that there is a large gap between the lines of the report. This is because of the space left at the bottom of the Detail area: the size of the Detail area determines how much space will be used on the report for each record.

To eliminate this space, and move the lines of the report closer together:

> Position the mouse pointer over the top edge of the Page Footer bar, until the pointer changes to a double-headed arrow.

> Click and drag this line until there is only a small gap underneath the row of fields.

> If you want to check the effect of this, click the Print Preview button again.

Figure 21 - Preview of Initial Course Authors Report

The final appearance of the report would be improved by adding a title at the top of the page, and some headings for the columns of information. Some of the controls you will need for this are obscured by the field list box, so:

> Move the box by clicking on its title bar and dragging it to another position on the screen.

OR

Double-click on its control box to close it.

To add text to the report, use the Label button in the Toolbox:

> Click on the Label button .

> Move the pointer into the Page Header area - it should change to a large A with a + sign (shown right).

The + marks the actual position of the pointer.

> Place the + in the top left corner of the Page Header area, then click and drag to define a box large enough to enter a title (you can resize it later if you don't get it exactly right first time).

> Type a suitable title into the box - for instance, Authors of Courses - and press [Enter].

Since this is a title, you probably want to make it large and bold:

> Click on the Font Size drop-down arrow in the toolbar, and select a suitable size - try something like 14.

> Click on the Bold and/or Italic buttons, as you prefer.

Finally, it would be useful to have some column headings as part of the Page Header. You will probably need to make room for these first.

> Move the pointer to the top of the Detail bar until you get the double-headed arrow, then click and drag it down until you have enough extra space in the Page Header area.

> Click on the Label icon in the Toolbox, then drag out a label box immediately above the Tutor Name field. Type in a suitable label - for instance, Tutor Name! - and press [Enter].

> Repeat the process to add Course Name and Department labels.

Again, you probably want to make these headings bold and slightly larger than the Detail text. You can treat all three labels at once:

> Hold the [Shift] key down, and click on each label until all three are selected.

> Select a font size and bold or italic attributes from the toolbar - all three field will change together.

Your screen should now be similar to Figure 22 (below).

Figure 22 - Design of the Final "Authors of Courses" Report

You can now look at the Print Preview again - it should be something like Figure 23. If it is not exactly as you want it, you can return to the Design View and make adjustments. Repeat this process as many times as necessary until you are satisfied.

Finally:

> Save the report; call it something like Report of All Course Authors.

Figure 23 - Preview of Final "Authors of Courses" Report

6.2 Running a Report

To run a report:

> Click the Report tab in the Database Window.

> Choose the report.

> Click the Preview button to generate the report and see what it will look like.

To print the report:

> Choose the report as above.

> Select the File menu, then the Print option

or, in the Print Preview window:

> Click on the Print button , or select File, Print
.


Previous Section Contents Docs Index