Section 11.4. Fine-Tuning Reports with Properties


11.4. Fine-Tuning Reports with Properties

As you've already learned, you can most easily tweak your report's controls with the toolbar buttons . However, even though the toolbar's packed full of useful features, it doesn't have everything. Behind the scenes, each control has a host of low-level settings, known as properties . Many of these settings are obscure, and people rarely use them. Some are known only to a small number of antisocial Access junkies. But a few are genuinely useful, because they provide features that you can't reach anywhere else in Access. You can hunt down and change these settings only with the Property Sheet.


Tip: The Properties window's occasionally useful for report writing, but it becomes much more important when you tackle forms in Part Four and add code in Part Five.

To show the Property Sheet, choose Report Design Tools Design Tools Property Sheet. The Property Sheet appears at the windows right side (Figure 11-16).

The Property Sheet lets you fine-tune a single report item at a time. You choose the item by selecting it on the design surface, or choosing it from the drop-down list at the top of the Property Sheet. If you want to tweak a specific control, it's usually easier to click to select it on the design surface. The drop-down list's by name , and Access doesn't always use the most intuitive names . Sometime they match the underlying field (like ProductCategoryID ), and sometimes they don't (like Text3 ).

Most controls have a similar set of properties. To help get around this intimidating long list, the Property Sheet divides it into the following tabs:

  • Format contains the options you'll change most often, including the font, color , borders, and margins.

  • Data identifies where the control gets its information. For the controls in the detail section, this tab identifies the linked field's name. Usually, you don't need to change these settings on your own.

  • Event lets you attach Visual Basic code that springs into action when something specific happens. You'll learn much more about code in Part Five.

  • Other includes the Name property, which defines the control name, and a few miscellaneous properties that are more relevant with forms.

  • All shows the whole shebang.

Figure 11-16. The Property Sheet shows a list of settings (known as properties) for a single control. You can see the full list in the All tab, or you can see a partial list of properties in one of the other tabs. In this example, a text box control's currently selected.



Tip: To get a quick one- sentence description of a mysterious property, click to select it in the Property Sheet, and then, at the bottom of the Access window, look for the descriptive text that appears in the Status bar.

Interestingly, controls aren't the only thing you can change in the Property Sheet. You can also adjust report settings (at the top of the Property Sheet, choose Report in the drop-down list), which identify where the data comes from and how you can view or edit the report. And you can tweak settings that are specific to a particular section (like ReportHeader, ReportFooter, PageHeaderSection, PageFooter-Section, and Detail), which include page break details and additional formatting.

Of course, it's one thing to know that there are a bunch of settings you can change, and another thing entirely to know what settings are worth tweaking. The Property Sheet's cluttered with a lot of properties that aren't worth your time. In the next section, you'll consider a table (Table 11-1) that lists the most useful properties in reports.

11.4.1. Modifying Common Properties

If you're still a little overwhelmed by the Property Sheet, then try the following steps. They walk you through the process of making a change:

  1. Select a control on the design surface .

    Its properties appear in the Property Sheet.

  2. Click the Format tab, and then scroll down the list until you find the Back Color setting .

    The Back Color setting determines the color that appears for the control background, behind the text.

  3. Click the Back Color box. An ellipsis ( ) button appears in the box. Click it .

    A color picker dialog box appears.

    The Back Color box shows a color number that represents the color. But unless you've memorized hundreds of thousands of cryptic color codes, you'll find it easier to choose the color from the color picker dialog box.

  4. Choose a color .

    The new color appears immediately, along with the new color number.

You can also use this technique to set the background for an entire section of the report. From the drop-down list in the Property Sheet, just choose a section like ReportHeader or Detail, and then follow these steps.


Tip: If you change the background color of a report section, then make sure you also change it for all the controls on that part of the report, or they'll have white boxes around them. You can select all the controls you want to change at once by dragging a selection box around them, or you can just hold down Shift, and then click each one. Then, head to the Property Sheet to make your batch change.

In this example, you could change the background color more easily using the ribbon. However, you can change many properties in the Property Sheet that have no equivalent in the ribbon. Table 11-1 lists a few useful examples, all of which you find in the Format tab.

Table 11-1. Useful Control Properties (in the Format Tab)

Selected Item

Property

Description

Any control that shows text

Text Align

Normally, the alignment depends on the type of data you're displaying. For example, Access right-aligns numbers and dates. If you want to compare a long list of numbers, then this system makes sense. But if you want your numbers to line up with other pieces of text data, then you can choose a different alignment option here, like Left or Center.

Text box

Format

Normally, Access uses the number formatting that's defined for your data type, and you don't need to worry about this setting. However, if you're using a calculated expression (Section 7.1), then Access shows the result as an ordinary number, even if you want two decimal places and a currency symbol. To fix this, choose the format you want (like Currency). Section 2.3.3.2 describes your other options.

Text box

Can Grow

If you set Can Grow to Yes, Access expands the field vertically to fit its content. Can Grow is switched on for all fields when you create a simple tabular report, but it's not necessarily on for other types of reports that you generate with the Report wizard. When it's not switched on, Access chops down long content to fit the available space.

Report

Default View

Determines what view your report starts in when you open it by double-clicking its name in the navigation pane. Ordinarily, you start in Report view.

Report

Page Header and Page Footer

The standard setting, All Pages, places the header and footer on every page. Alternately, you can choose to leave the page header or page footer out on pages that include the report header or report footer.

PageHeaderSection, Page-FooterSection, Report-Header, ReportFooter

Display When

Ordinarily, these sections appear onscreen, and in the final printout. Alternately, you can choose to include them in either the onscreen representation or the printout, but not both.

Detail

Force New Page

Ordinarily, this property's set to None, and Access packs in as much information as possible before moving to the next page. Alternatively, you can use Before Section to start each record on a new page. The other Force New Page options are intended for use with grouping (Section 11.6).

Detail

Keep Together

If set to Yes, then Access never splits the detail section over a page break in a printout. If there isn't enough room for a complete record left on a page, then Access skips straight to the next page, and resumes printing there.




Access 2007[c] The Missing Manual
Access 2007[c] The Missing Manual
ISBN: 596527608
EAN: N/A
Year: 2007
Pages: 153

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net