Software Catalog:
Report Basics

A Simple Report

So far we've done a pretty good job building an application for data entry. But data entry is only half the job of an application. If we can't get data OUT of the application there's no point in putting data IN to the application.

The next thing we will need to do to make this application work is look for ways to get data out of it in meaningful ways. So your homework assignment is to think of meaningful ways to display the data.

The first report will be a simple telephone list of the software manufacturers in our file. In the database window choose the Reports tab and click the New button.

Choose Report Wizard from the list in the first dialog box. Open the dropdown list box and choose Manufacturers or you can type it in the edit box portion of the dropdown list box. Click OK.

The next dialog asks you to choose the fields you want in your report. This will be a simple telephone list, so we won't click the select all (>>) button. Instead choose these fields in the order listed below:

MfgName
MfgCity
MfgTelephone
MfgFax
E-Mail
MfgID

Then click the Next button.

We will not group the manufacturers. Click Next here. For the sort order choose MfgName in the first dropdown list box. Notice that you have the option of sorting A-Z or Z-A by clicking the button labeled A-Z. We will leave the default A-Z sort order. Click Next.

You choose the layout in the next dialog. If you have Access97 the illustration changes for each radio button selection. If your illustration doesn't change here's what the different report types listed mean:

Columnar is a vertical listing of the field names and the data one field per line. Tabular is a spreadsheet-like listing of each record, one per line. Justified applies to multi-table reports that are grouped with many detail records for each group.

We will choose tabular and landscape for the paper orientation. Portrait refers to vertical paper orientation similar to most portraits. And similarly, landscape means horizontal paper orientation like most landscape paintings.

The next dialog presents a list box of styles. Selecting a style changes the illustration in the image box to the left. Choose one that you like and click Next.

Type a name for your report or take the Access suggesting. I named this one Manufacturers Telephone List. Preview the report. You can go back and change anything you wish later. This is not the case with every database manager I have tried. Click Finish.

On preview we see the field names listed for each record. Once on the top of each page is all that is necessary so we will modify the design a bit.

Before doing surgery on your new report you may want to make a backup copy in case something goes wrong with what we are about to begin.

Open the report in design view. That is, select Manufacturers Telephone List then click the Design button.

The first thing I notice is that the report title is truncated. Select the label that contains it and drag the center right handle to the right to lengthen the box so that all of the title displays.

Next, put your cursor on the line that separates the Page Header and Detail sections of the report. When your cursor becomes a two-headed arrow with a horizontal line between drag the detail border down to open a little more than ½ inch in the Page Header section.

A blue border produced by the corporate style surrounds my detail section. If you have something like that you can move it to the page header or delete it. To move it select it so the only the handles of the border appear. Then cut it to the clipboard. Click in the header section then paste.

If your fields and field names display with borders this makes a very busy looking report. To remove this excess decoration select all the fields edit boxes along with the field name labels. Hold down the shift while you click on all of them. On the Format page of the properties box change the Border Style to transparent. If necessary change the Border Color to 0.

Make any appropriate adjustments to the length of the fields edit boxes and the associated labels. You can select a field and its label and operate on both at once.

Here's where you need to be careful. Select all the field name labels by shift clicking on them. Cut them from the detail section and paste them in the page header section. Drag them to position. You can adjust the tops to match if they don't by selecting all then entering the desired top offset into the Top property. I used .02 for my fields' offset in the detail section and .04 for the offset in the header.

Save your work and preview again. If you like what you see this is a good time to delete the backup from the database report window.

Mailing Labels

Although there's not a lot of need for mailing labels in this application, we'll create one just to go through the process.

Start a new report. Choose Label Wizard and Manufacturers table. Choose your Avery label number. You can select by the label dimension and number across and kind of form (continuous or single sheet). I chose number 5260, which is the very common 2 5/8" X 1" Three across label commonly used for addresses.

My wizard then gives me the opportunity to select the font name, size, weight, and attributes. After we finish the label we will talk about font manipulation in the design window to see how this works in all reports and forms.

You are asked to construct a prototype label. Select MfgName and press > then press ENTER. Select MfgMailAddress, >, ENTER, MfgCity, >, ENTER, Comma, Space, MfgState, >, Space, MfgZip, >, MfgZipPlus4, >, ENTER. Press Next to continue.

Sort by MfgZip and MfgName in that order. Name it Manufacturers Mail Labels, and view your report. Microsoft Access did a fine job except we need a hyphen between the 5-digit zip code and the last 4 digits, but only if they exist.

We'll put an if statement in to fix that. This is actually Iif(). Although the Microsoft Access help file does not explain this name, somewhere this identified as an Immediate If. It is an if statement that is written in one line and can be used in calculated data fields. It also is used in Excel. In the control source for the City, State, Zip line change it so that it reads as follows, but all on one line in the Control Source:

=Trim([MfgCity] & " , " & [MfgState] & " " & [MfgZip] & If (IsNull([MfgZipPlus4])," " ," -" & [MfgZipPlus4]))

The if statement says if the field MfgZipPlus4 is null (contains no data) then display nothing else display a hyphen and the field value.

Notice that the wizard put all of this inside a Trim function. If your version didn't simply add =Trim( to the beginning of the source and close parenthesis at the end ).

The top of the Microsoft Access window contains a toolbar for manipulating text to rival that of many word processors. To change a font, its size or attributes, simply select the field or fields to be changed and select the font from the dropdown list of fonts installed on your system. The next list is of sizes. If you are using scalable True Type fonts or Adobe Postscript fonts you can choose any size you wish. If you are using bitmapped fonts you must limit yourself to the sizes installed.

With a click of a button you can bold, italicize, or underline any text on your form or report. Use the alignment buttons to left or right align or center your text. To align labels or text boxes use the Align menu in the Format menu.

Next we will develop a report that will draw data from more than one table. This report will list the software that is installed on each system in your computer fleet and software that remains on the shelf uninstalled.



Return to Beginning
Continue
Previous
This document authored by Pat Tyler
Copyright July 1997