[ Team LiB ] |
Recipe 3.3 Create a Report with Multiple Columns3.3.1 ProblemYou want to print a two-column, phone-book-style report with large initial capital letters to set off each alphabetical grouping. There is no Report Wizard for creating such a report, and you don't see a Column property to set up the number of columns you want. How can you make a multiple-column report in Access? 3.3.2 SolutionThere is a way to format a report for multiple columns, but it's not where you might look for it, on a report's properties sheet or the report design menu. Instead, you'll find it on the Columns tab of the Page Setup dialog. This solution guides you through setting up a multiple-column, phone-book-style report that includes a large drop cap for each letter of the alphabet. Follow these steps to create your own multiple-column report:
Figure 3-5. The Columns tab of the Page Setup dialog
Follow these additional steps to create the first letter grouping shown in Figure 3-7:
Figure 3-6. The completed rptPhoneBook report in design view
Now, load 03-03.MDB. The tblCompanyAddresses table contains a list of businesses and their addresses and phone numbers. Open rptPhoneBook in preview view. This report prints the data in two snaking (newspaper-style) columns (see Figure 3-7). Figure 3-7. The two-column rptPhoneBook report3.3.3 DiscussionWhen you create a report, Access assumes you want only one column unless you specify otherwise. If you want more than one column, you must adjust the layout properties of the page using the Columns tab of the Page Setup dialog. The key settings are Number of Columns, Column Spacing (the extra margin between columns), Width (the width of each column), and Column Layout (whether Access first prints an entire column or an entire row). If you want to produce snaking-column (newspaper-style) reports, select "Down, then Across" for Column Layout; for mailing-label-type reports, choose "Across, then Down". For most purposes, you can ignore the other settings. You will usually create groups in reports that break on the value of a field itself. For example, grouping on Company will trigger a new group for each new unique value of the Company field. Access, however, includes two group properties that allow you to alter the frequency of groupings: GroupOn and GroupInterval. Depending on the data type of the grouping field (see Table 3-6), you can use GroupOn to group on some subset of characters (Text), a range of numbers (Number, Currency), or a period of time (Date/Time). Using the GroupInterval property, you can adjust the grouping further—for example, you could break on the first two characters of a name, every $10, or every two months.
When you use the GroupOn property to group on anything other than Each Value, you must realize that the records within the groupings will not be sorted. This means that in most cases you'll also need to include a second sorted copy of the field with GroupOn set to Each Value. This is what we did in the rptPhoneBook example.
There are several section, report, and group properties that you can adjust to control whether a group is kept together on the same column or page and whether a new column or page is started before or after a group. 3.3.4 See AlsoSee the Solution in Recipe 3.14 for more details on controlling page and column breaks. |
[ Team LiB ] |