how to do everything with microsoft office access 2003 phần 5 docx

56 305 0
how to do everything with microsoft office access 2003 phần 5 docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

9 4. Double-click the attached label that shows Textn and type Tota l C os t, where n is the sequentially numbered label. 5. Repeat steps 1 through 4 to add another calculated field to show estimated work time with the expression =[Completion Date]-[Start Date] and label it Work Time (days). 6. Switch to Form view to see the design with the new calculated fields. You can see that although the two cost fields retain the currency format with the dollar sign and two decimal places, the Total Cost field does not. A later section in this chapter, “Use Property Sheets,” discusses how to correct this. CHAPTER 9: Understand Form and Report Design Basics 201 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 Dress Up with Lines and Rectangles Although not essential, lines are useful in forms and reports to create a visual separation between parts of the design. A heavy line can help focus attention on a specific area. You can draw a line anywhere in a form or report section. To draw a line, click the Line toolbox button and click where you want the line or drag the pointer to draw the line. If you just click in the design, Access draws a solid horizontal line 1 inch long and 1 point thick. When you drag to draw the line, you can drag it in any direction and to any length. To make sure the line is horizontal or vertical when you draw it, hold down SHIFT while you draw. Rectangles come in handy as boxes that group related data or as a means to emphasize another control. For example, in a form you can draw a box around a set of command buttons to set them off from the rest of the design. To draw a rectangle, click the Rectangle toolbox button and draw the box in the design. After drawing the line or rectangle, you can use the Formatting toolbar buttons to change the line or border thickness, choose colors, and add a special effect. You also can use the property sheet to change the line or rectangle border style; for example, to a dashed or dotted line. If you draw a rectangle around other controls and add a background color, you might obscure the other controls. To cure this, select the rectangle and choose Format | Send To Back to place it behind the others. P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:51 PM Color profile: Generic CMYK printer profile Composite Default screen Modify Controls You can customize the controls you add to a form or report design to present information in just the right way. Controls can be moved about in the design or resized, and any of the properties can be changed to create the appropriate effect. To change any control, you first must select the control to focus Access on the object with which you want to work. Select Controls and Other Objects There are many ways of selecting the form or report design, one of the design sections, or one or more controls. The Object button on the Formatting toolbar displays a complete list of every element of the design: the form (or report); each of its sections; and all the controls in the design, including any added lines and text. The list is in alphabetical order. To select one of these, choose from the list. You might need to scroll down the list to find the element you want to select. Select the Form or a Form Section Once the form or form section is selected, you can view and change any of the properties, including the record source, in the form or report property sheet. You can select the form itself in the following ways: ■ If the rulers are displayed, click the form selector (the small square in the upper-left corner where the horizontal and vertical rulers meet) ■ Choose Edit | Select Form (or Report) or press CTRL-R ■ Click anywhere in the plain gray background, within the window, but outside the form design In addition to choosing from the Object list, you can do one of the following to select a form or report section: ■ Click the section selector (the small box in the vertical ruler opposite the section bar) ■ Click in the section bar ■ Click anywhere in the gray background of the section 202 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 Form selector Section selector Section bar P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:52 PM Color profile: Generic CMYK printer profile Composite Default screen 9 When a section is selected, the section bar, the horizontal divider that contains the section title, appears shaded. Select Controls That leaves the controls themselves. To select one control, you can simply click in the control or choose the control name from the Object list on the Formatting toolbar. When you select a control, a set of small dark squares called handles appear around the control. You use these handles to move and resize the controls. The larger squares are the move handles and the smaller ones are the sizing handles. You’ll learn more about moving and resizing later in this chapter. If you want to make the same change to several controls at once, you can select more than one of them in one of the following ways: ■ Hold down SHIFT as you click each control. ■ To select a column of controls, click the selection arrow in the horizontal ruler above the controls. ■ To select a row of controls, click the selection arrow in the vertical ruler to the left of the controls. ■ To select a block of controls, click the selection arrow in one of the rulers and drag to draw a rectangle around the controls. This selects all the controls that are inside or partially within the rectangle. ■ To select a block of controls within the design but not a complete column or row, click in the design outside of any control and draw a rectangle around the controls. ■ To select all the controls in the design, choose Edit | Select All or press CTRL-A. To remove the selection, click anywhere outside the selected objects. To remove only a few controls from a group of selected controls, hold down SHIFT and click each of the controls you want to exclude. A text box control is a special case because it contains two parts that can be treated together or separately. The attached label usually is the field name, and the edit region displays the field value. If you click the edit region to select a text box control, you can change the text box properties. If you click the attached label, only the label is selected and you can change its properties. You can tell by the size and number of handles that appear around the control whether you have selected them both or only the label. Two text box controls are shown in the following CHAPTER 9: Understand Form and Report Design Basics 203 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 Move handles Sizing handles P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:52 PM Color profile: Generic CMYK printer profile Composite Default screen illustration; both the label and the edit region of the Labor Cost control are selected whereas only the label of the Material Cost control is selected. Once you have selected the controls you want to work with, you can move, resize, align, or space them equally or change any of their properties. Group Controls If you have several controls that you want to look and behave alike, you can define them as a single group and format them all at the same time. To create the control group, select all the controls you want to include, including the labels for the text box controls, and choose Format | Group. A frame appears around the set of controls but does not show up in Form view. The new form shown in the following illustration contains the cost fields in a single group. To remove the group designation, choose Format | Ungroup. Move and Resize Controls One reason to select a control is to change its size or move it to a different position in the design. As mentioned earlier, when you select a control, handles appear around the control. These handles are used to move and resize a control or a selected group of controls. Move Controls To move a control in the design, move the mouse pointer to the move handle (the larger square in the upper-left corner of a selected control). When the pointer changes shape to an open hand, click and drag the control to the desired position. You can drag it over other controls to place it where you want it. Again, the text box control is a special case because it has two move handles. If the pointer shows as an open hand, the control and its label move together. If the mouse pointer changes to a pointing hand instead of an open hand, you can move the edit region by itself. When you move the mouse pointer to the move handle of the attached label, it always changes to a pointing hand so you can move the label by itself. You can’t move both parts with the move handle in the label unless you have also selected the label. 204 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:52 PM Color profile: Generic CMYK printer profile Composite Default screen 9 Dragging a control by its move handle can be inaccurate, so if you want to move a control a smaller or more precise distance, hold down CTRL and press the appropriate arrow key. Each key press moves the control one-fourth of a grid unit in the direction of the arrow. Holding down CTRL while you drag a control temporarily turns off the Snap To Grid feature. If you have selected more than one control, you can drag any one of them and all will move together. Resize Controls A selected control has seven sizing handles, one on each side and one at each corner (except the move handle corner). Dragging one of the side handles changes the width or height whereas dragging a corner handle can change both height and width at once. If you have selected several controls, all will change size the same when you drag the sizing handle of one of them. If you need to make more precise adjustments in the size of the selected control, hold down SHIFT while you click the appropriate arrow key. Each keypress increases or decreases the size of the control by one grid unit. The Format and shortcut menus also have options that help you size one control or a group of controls so that they match in length or width. First select the controls you want to resize, then choose Format | Size or right-click and point to Size in the shortcut menu. The first command, To Fit, resizes a control to fit its contents. For example, if you have drawn a long label control and entered short text, choose the To Fit command to reduce the size of the control to fit the entered text. The second command, To Grid, automatically adjusts the size of the control so that all four corners fall on the nearest grid points. Double-clicking one of the sizing handles automatically resizes the control to fit the contents. The remaining four commands adjust the size of each control in a group of controls relative to the tallest, the shortest, the widest, or the narrowest of the group. CHAPTER 9: Understand Form and Report Design Basics 205 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:53 PM Color profile: Generic CMYK printer profile Composite Default screen Align and Space Controls Lining up the controls in a form gives the form or report a professional look. To align a group of controls, select them first, then choose Format | Align or right-click and point to Align in the shortcut menu. The last command in the Align menu, To Grid, places the upper-left corner of all the selected controls on a grid mark. If you have Snap To Grid checked, this is automatically done. When aligning controls, be sure to select only those in the same row or same column. If you have controls in the group from a different area of the form, they will be aligned with the rest, creating a confused appearance. When you have a row or column of controls that you want uniformly spaced across or down the form or report, you can use the Horizontal Spacing or Vertical Spacing commands in the Format menu. These commands also are used to increase or decrease the spaces evenly between the controls. Each time you choose Increase or Decrease, the spacing is changed by one grid interval. Use Property Sheets Properties establish the characteristics of form and report design elements. Everything in a form or report design has propertiescontrols, sections, and even the form or report itself. Control properties set the structure, appearance, and behavior of the controls. Properties also can determine the characteristics of the text and data contained in a control. Property sheets contain lists of all the properties that pertain to the selected control or group of controls. To open a property sheet for a control, do one of the following: ■ Double-click the control ■ Select the control and choose View | Properties ■ Select the control and click Properties on the toolbar ■ Select the control and press ALT-ENTER ■ Right-click the control and choose Properties from the shortcut menu 206 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:54 PM Color profile: Generic CMYK printer profile Composite Default screen 9 CHAPTER 9: Understand Form and Report Design Basics 207 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 The list of properties will depend on the current selection. The All tab of the property sheet for the Workorder Number text box control lists all the control’s properties. As you can tell by the scroll bar, there are more properties in the list. The properties are grouped in the sheet by type: Format, Data, Event, Other, and All. Click on the tab that will show the properties you want to change, or stay with All to see the entire list. To change a property, click the property in the list, then do one of the following: ■ Type the desired setting in the property box ■ If an arrow appears in the property box, select the desired setting from the list ■ If a Build button (…) appears, click it to display a builder or a dialog box with a choice of builders, depending on the type of control When you click a property in the property sheet, you can see a description of the property in the status bar. If you need more information about the property or how to use it, press F1. The calculated field, Total Cost, which we added to the Workorders data entry form earlier, needs to show currency symbols. To set the format property: 1. In the form Design window, double-click the edit region of the Total Cost text box control. 2. Click the arrow in the Format property box and choose Currency from the list. P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:54 PM Color profile: Generic CMYK printer profile Composite Default screen To apply the same property settings to a group of controls of the same type, select them all, then open the property sheet. Only those properties common to all members of the group are visible in the sheet. Once you open a property sheet, it remains on the screen until you close it. To set properties of a different object in the design, select the object from the drop-down list at the top of the property sheet or select the control in the design. Assign a Default Value When you assign a default value to a bound control in a form or report design, the value you enter overrides any default value set in the underlying table design. The default value you assign is stored in the field when a new record is entered in the form unless you enter a different one. For example, if you are entering new bid data and one of the fields in the form is the date, you can assign the current date as the default value. This automatically stores the current system date in the new record. To assign the current date as the default value, type =Date() in the control’s Default Value property box. Change Default Control Properties Access provides a default set of properties for each type of control. The set specifies the general appearance and behavior of that type of control. For example, the default properties for a text box control determine the font size and alignment of text within the attached label. Another default text box property automatically includes the field name as an attached label. This set of properties is called the default control style for that control type. If you think you will want different default control styles, you can save time by making the changes before starting to create the form. If you find that you are making the same changes to most of the controls of a certain type, you can change the default property setting. For example, if you usually want a larger font size in your text boxes, change the Font Size from the default size of 8 to a larger size. Or, if you don’t want the attached labels for every text box, change the Auto Label property on the Format tab to No. When you change a default setting to the one you use most, you save space. Access doesn’t need to store both the default and the custom settings. To change a default property setting: 1. Click the tool in the toolbox for the desired control type. 2. Click Properties on the toolbar. The property sheet for that control type opens, but the title bar indicates that these are the default settings instead of the settings for a particular control in the design. 208 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:55 PM Color profile: Generic CMYK printer profile Composite Default screen 9 3. Change the setting in the default property sheet. If you have already made changes to a control and like what you see, there is a quick way to copy the changes to the control type’s default style. Any new controls now will use the properties from the existing control as a default control style. Select the control that has the characteristics you want as defaults for subsequent controls, then choose Format | Set Control Defaults. Use the Formatting Toolbar The Formatting toolbar is a quick way to change the appearance of the text in selected controls. The toolbar is optional when you are designing a form or report. To see the Formatting toolbar, choose View | Toolbars and check Formatting (Form/Report). You also can right-click in any menu bar or toolbar and choose Formatting (Form/Report) from the shortcut menu. The Formatting toolbar has, in addition to the Object button we’ve already discussed, eight buttons for formatting text in the design. These eight buttons change the font name, size, and style and align the text within the control boundaries. The last five buttons give you a quick way to change the color and style of many elements in the design. The three color buttons each display a color palette you can use to change the color of the background, the font, or the border of a control. The fourth button changes the thickness of the selected control’s border and the last button adds special effects to a control or an entire section such as raised, sunken, shadowed, etched, chiseled, and flat effects. If you want to apply the same formatting property changes to a group of similar controls, select them all, then change the common property. Format Conditionally Conditional formatting was introduced in Access 2000. You can use it with text boxes and combo boxes to specify a default format for the control and up to three additional formats to be applied under special conditions: the current value of the field, when the field gets focus, or when an expression evaluates to True. The expression can refer to the values in other fields in the same CHAPTER 9: Understand Form and Report Design Basics 209 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:55 PM Color profile: Generic CMYK printer profile Composite Default screen 210 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 record. For example, if the date in a field is more than 30 days ago, display the value in this field underlined and in red on a light green background. To activate conditional formatting, select the control you want to apply it to and choose Format | Conditional Formatting. The Conditional Formatting dialog box shows two areas: one for setting the default format and one for specifying a conditional format to be applied under specific conditions. The formatting choices include bold, italic, and underline as well as text and background colors. The button on the right end of the condition box enables or disables the control. When a control is enabled, you can reach it by pressing TAB. If it is disabled, it is skipped in the tab order. The box in the middle displays an example of how the chosen formatting will look. To set conditional formatting, set the default format, then move to Condition 1. In the first box, you have a choice of conditions: ■ Field Value Is Defines the value or range of values for which to apply the format settings ■ Expression Is Applies the formatting if the expression you enter evaluates to True ■ Field Has Focus Applies the formatting to the field as soon as it gets focus Depending on which selection you make in the first condition box, other specifications can be made in the other boxes. If you choose Field Value Is in the first box, you have a choice of several comparison operators. If you choose Expression Is, you have only one box in which to enter the expression. Field Has Focus requires no additional criteria. P:\010Comp\HowTo8\938-1\ch09.vp Thursday, August 07, 2003 7:11:55 PM Color profile: Generic CMYK printer profile Composite Default screen [...]... then click OK Figure 9-7 shows the title page of a report with a picture of Home Tech Repair equipment in the background 2 15 9 216 How to Do Everything with Microsoft Office Access 2003 FIGURE 9-7 A report showing a background picture In some designs, you might want to overlap controls with one in the foreground and the other behind The Format | Bring To Front and Format | Send To Back commands determine... and decide to show or hide the primary key field Click Next 6 The next dialog box asks what you want Access to do with the value you select in the list box or combo box: ■ Remember the value for later use Saves the value for use by a macro or procedure When you close the form, the value is erased 10 230 How to Do Everything with Microsoft Office Access 2003 ■ Store that value in this field With this... boxes by choosing Format | Align | Top while they are still selected You can also add a line to separate the material and labor cost from the calculated fields that show the total and extended costs First, move the two calculated fields down a little to make 10 226 How to Do Everything with Microsoft Office Access 2003 room for the line Then click the Line control button and draw a line across under... Create a Form Without the Wizard You don’t need the help of a wizard to create your form You can start a new form by one of the following methods: ■ Double-click Create A Form In Design View in the Database window ■ Choose Design View in the New Form dialog box 222 How to Do Everything with Microsoft Office Access 2003 FIGURE 10-3 Choose the form layout When you start a new custom form without the help... Design view ■ Create form by using wizard 220 How to Do Everything with Microsoft Office Access 2003 Use the Form Wizard When you choose Form Wizard from the New Form dialog box or double-click the shortcut item, the first wizard dialog box opens where you choose the fields to add to the form If you haven’t selected a table or query, you can do that here too To start a new form design based on the Current... buttons, or toggle buttons If the option group is bound to a field, the frame itself is the bound object, not the individual controls in the group When you create an option group, you specify the values of the options in terms of numbers that are meaningful to the underlying field When you select an option in the 10 232 How to Do Everything with Microsoft Office Access 2003 group, that value is stored... Enter a name for the button or accept the default name Click Finish Figure 10-9 shows the Current Workorders form with the new Print Record command button When the Command Button Wizard builds the button for you, it writes an event procedure containing Visual Basic code to store with the form Add Hyperlinks In Chapter 5, you saw how to add a hyperlink field to a table and how to insert a hyperlink address... control to the Home Tech Repair Roster form that will jump to the Employees table: 1 With the form open in Design view, click the Insert Hyperlink toolbar button or choose Insert | Hyperlink The Insert Hyperlink dialog box opens 10 FIGURE 10-9 A Print Record command button added to a form 236 How to Do Everything with Microsoft Office Access 2003 2 Enter the filename for the hyperlink, a Web address... enable you to choose from a list of values 10 224 How to Do Everything with Microsoft Office Access 2003 FIGURE 10-4 Adding a title to the form header section List boxes limit your choice to values in the list but combo boxes usually let you type entries and choose from the list Either of these can be bound or unbound If the control is bound, the selected or entered value is stored in the field to which... choose Edit | Delete If you change your mind, you can restore the control by clicking Undo on the toolbar (or choosing Edit | Undo) You can delete more than one control by selecting them all, then pressing DEL With the Office 2003 stacked Undo/Redo, you don’t have to act immediately to reverse an action You can select the action from the Undo drop-down list Original Control Permitted Conversions Label . section 202 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 Form selector Section selector Section. label. 204 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 P:10CompHowTo8938-1ch09.vp Thursday,. selectively. 214 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 9 P:10CompHowTo8938-1ch09.vp Thursday,

Ngày đăng: 14/08/2014, 08:22

Mục lục

  • PART II Retrieve and Present Information

    • CHAPTER 9 Understand Form and Report Design Basics

      • Modify Controls

        • Select Controls and Other Objects

        • Move and Resize Controls

        • Align and Space Controls

        • Use Property Sheets

        • Use the Formatting Toolbar

        • Format Conditionally

        • Change a Control Type

        • Delete Controls

        • Modify Form or Report Properties

          • Change the Record Source

          • Apply Filters and Sort Orders

          • Use AutoFormat

          • Add a Background Picture

          • CHAPTER 10 Create Custom Forms and Subforms

            • Create a New Form Design

              • Use the Form Wizard

              • Create a Form Without the Wizard

              • Modify the Form Design

                • Add Form Header and Footer Sections

                • Place and Customize Data-Related Controls

                • Add Yes/No Controls

                • Add User-Interactive Controls

                • Use the Form for Data Entry

                  • Size the Form

                  • Navigate in the Form

Tài liệu cùng người dùng

Tài liệu liên quan