Visual Elements and Tools


Whether you're discussing databases, dogs, or dirigibles, looks count. In the case of databases, attractive design is not merely a matter of making your reports and forms look pretty. A more aesthetically pleasing form or report often means greater efficiency and enhanced functionality.

Here are a few Access features to convey information more effectively or improve the appearance of your database objects. (The formatting toolbar is shown in Figure 12.13.)

Figure 12.13. The tools of the Formatting toolbar.

1 Object Selector

2 Font

3 Font Size

4 Bold

5 Italics

6 Underline

7 Align Left

8 Center

9 Align Right

10 Fill/Back Color

11 Font/Fore Color

12 Line/Border Color

13 Line/Border Width

14 Special Effects


Datasheet Fonts

Usually there's little reason to change the default Arial 10-point font in tables. Although you can bold, underline, or italicize datasheet text, it usually serves little purpose. These fonts do not make your data easier to view. Conditional formatting can occasionally be helpful, as discussed in the next section.

If you do want to experiment with different fonts, avoid serif fonts (such as Times New Roman) for onscreen viewing. (A serif is a fine line projecting from the main stroke of a letter, such as that at the bottom of the letter t.) Instead, stick with nonserif fonts such as Arial.

Conditional Formatting

You can use conditional formatting in forms and reports to highlight specific numbers that meet conditions. You can apply a variety of special formatting, including bold, italics, and color.

Figure 12.14 shows the Conditional Formatting dialog box with the first drop-down list open to display three choices: Field Has Focus, Field Value Is, and Expression Is.

Figure 12.14. In the Conditional Formatting dialog box, use the Field Value Is setting to apply conditions in the same field.


If you want to set a condition in the same field, use Field Value Is. For example, say you want values in the ShipCost field to be red whenever they're over $10. Follow these steps:

1.

In Design view of the frmOrders form, right-click the ShipCost text box and choose Conditional Formatting (or choose Format, Conditional Formatting).

2.

In the Condition 1 section, select Field Value Is in the first drop-down list.

3.

Open the second drop-down list and choose Greater Than.

4.

In the box to the right, type 10.

5.

In the same Condition 1 section, open the drop-down color palette on the Font/Fore Color button (see Figure 12.14) and choose a red swatch. Click OK.

6.

Click View to go to Form view. Scroll through several records to see that values in the ShipCost field that are above $10 are now in red.

7.

Click View to return to Design view.

You use the Expression Is choice when you want the formatting to change in one field when a condition is true in another field of the same record. For example, suppose you want the shipping date to be highlighted whenever the shipping cost is over $10. Here are the steps:

1.

Select the ShippedDate control and choose Format, Conditional Formatting.

2.

Open the drop-down list in the Condition 1 section and select Expression Is.

3.

In the box to the right, type [ShipCost]>10.

4.

In the same Condition 1 section, open the drop-down color palette on the Font/Fore Color button and choose a blue swatch. Click OK.

5.

Click View to switch to Form view and scroll through several records. Whenever the shipping cost is above $10, the shipped date is in blue.

6.

Click View to return to Design view.

7.

With the ShippedDate text box selected, choose Format, Conditional Formatting.

8.

Click Delete. Click the check box for Condition 1 and click OK twice.

9.

Right-click the ShipCost text box and choose Conditional Formatting.

10.

Click Delete. Click the check box for Condition 1 and click OK twice.

The conditional formatting for both controls has been removed.

Here are two other points worth noting:

  • You use the Field has Focus condition to apply special formatting to the value in the current record you happen to be in. In other words, let's say you move to a new record and the current field is OrderID. The value in the ShipCost field, which has a Field Has Focus condition of blue, looks the same as all other values in the record. When you click in the ShipCost text box, however, its value becomes blue.

  • You can set up to three conditions. If none of the conditions is true, the existing formatting is maintained. If more than one condition is true, Access applies only the first true condition. So let's say the field contains the number of units in stock for various products. If condition #1 is for products with counts between 20 and 50, and condition #2 is for those with levels between 20 and 30, the 20 to 50 formatting will be used for all records.

Special Effects

Special effects usually work better onscreen than on paperin other words, they have greater relevance for forms than reports. On paper, the layout of the material should be adequate to distinguish one type of information from another.

Figure 12.15 shows the various special effects available from the Special Effects palette on the Formatting toolbar in forms and reports. You apply them by selecting the control and clicking the effect. Here are some tips for working with them:

  • Don't go overboard. In the world of special effects, a little goes a long way. In any one section of a form, use just one special effect.

  • The effects themselves should be invisible. An effect should never call attention to itself. If a control shouts "Look at my beautifully chiseled frame!", remove the frame.

  • Be careful about white backgrounds. Effects often don't show up well against light backgrounds. The gray of an Access Auto Form or Report usually works better.

  • Use different frames for different elements. A raised frame helps draw the eye to a group of buttons. A sunken effect is better for check and option boxes.

Figure 12.15. Special effects are occasionally useful for highlighting controls and improving appearance.


Can Grow, Can Shrink

Let's say you have a field that contains state abbreviations, such as AZ and CA. You know you'll need just two characters for all of the field's values, so you set the Field Size property for the State field in the table at 2. When you create a form, that field size is inherited by the text box for the field. Therefore, you know exactly how much space the text box will take up on your form.

That's not the case for a field with a Memo data type whose contents are, say, the histories of countries. Then the amount of required space could vary radically from record to record. It's likely you'll want to enter many more words for China than for Chad.

In a form, you can have a scroll bar so that users can view the hidden text. But what do you do in a report? Because reports are usually printed, a scroll bar is no solution. If you need six times as much space for Italy as for Moravia, how can you make the report adapt to the changing space requirements?

The solution is the Can Grow and Can Shrink properties. When you set these properties to Yes in a report, the text box grows or shrinks to reflect the various space requirements.

What happens to the controls surrounding the Can Grow or Can Shrink text box? When a text box grows or shrinks, the entire report section grows or shrinks vertically. Adjacent controls move either up or down.

Also, note that a text box can't shrink to a height that's less than that of other controls on the same row. Let's say you have a text box with an accompanying label; the Can Shrink property in the text box is set to Yes. If there's no value in the text box, the label still appears, as does the text box, which cannot be shorter than the label.

As you can tell, this is definitely an area in which you'll want to switch frequently from Design view to Print Preview to see the impact of possible changes. Furthermore, try using test data of varying lengths to see how the controls adjust to various space requirements.

Reduce Empty Space

When you create a report, you'll sometimes find that it has a lot of empty space. Here are some things you can do to eliminate it:

  • Decrease section height. You might have lengthened a section to include more controls and never used the additional space (see Figure 12.16). Check for stretches of empty space, especially between sections, in either Print Preview or Design view. Right-click the section's bar; choose Properties, Format tab; and edit the Height property.

    Figure 12.16. The vertical space between 3.5 inches and 4 inches has no controls and is unused space.


  • Reduce the width of controls. It makes no sense to have a 2-inch text box for a two-letter State field. Right-click the text box, choose Properties, Format tab, and edit the Width field. For labels, in which the required space does not change from record to record, it's easy to get a quick best fit: Double-click any handle except the move handle in the upper-left corner.

  • Reduce the report's width. If there are no controls to the right of, say, the 5-inch mark on the horizontal ruler, you don't need a report that's 8 inches wide. Choose Edit, Select Report; then select View, Properties, Format tab. I recommend setting the Width at 5.5" just to leave a little extra room.

  • Move controls closer together. The Report Wizard sometimes leaves too much space between labels and their accompanying text boxes. Use the move handle on either control to drag one closer to the other.

Lines

A line has both functional and decorative purposes. You can use a line to indicate areas with similar information (such as a line that separates a form from a subform). You can also use a line with some color or style to add visual interest.

The Line tool available in the toolbox is not difficult to use. I'll just make a few points that perhaps are not immediately apparent:

  • For a straight line, press Shift as you draw the line.

  • To lengthen or shorten an existing line, press Shift and tap the right or left arrow key.

  • You can nudge a line up or down by holding down Ctrl and pressing the up arrow or down arrow key.

  • For a straight, 1-inch horizontal line, click the Line tool in the toolbox, drag it to the Design area, and click anywhere on the form or report.

  • Selecting a line can be difficult. Click the line at either end, or select the line from the Object Selector on the toolbar (refer to Figure 12.13).

  • Finding lines in a form can also be difficult, especially when they are drawn right below a section bar (see Figure 12.17). One method to help spot it is to choose Edit, Select All, which shows the line's handles (see Figure 12.18).

    Figure 12.17. A line directly below a section bar is difficult to locate.


    Figure 12.18. If you choose Edit, Select All, the handles on the line give you a better shot at picking it out.


  • The Line/Border Width button (see Figure 12.13) controls the width of a line. It has seven settings, with Hairline the slimmest and 6 the heaviest.

Finally, you don't need to draw lines to separate different sections of a form. By default, the Dividing Lines property on the Format tab of the Form property sheet is set to Yes.

Rectangles

A rectangle, available from the toolbox, is one way to highlight or segregate a group of controls with similar data. Rectangles are not difficult to create, and I think you can make your way around the toolbar to find the Fill/Back Color, Line Border/Color, Line/Border Width, and Special Effects buttons that control their appearance (refer to Figure 12.13).




Hands-On Microsoft Access(c) A Practical Guide to Improving Your Access Skills
Hands-On Microsoft Access: A Practical Guide to Improving Your Access Skills
ISBN: 0321245458
EAN: 2147483647
Year: 2005
Pages: 169
Authors: Bob Schneider

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