Working with the Form Design Window
You will use the Form Design window to build and customize a form. Using this window, you can add objects to a form and customize them by using the Properties window. Microsoft has supplied many form and control properties. After gaining a command of these properties, you can customize the look and feel of your forms.
Understanding and Working with the Form Design Tools
Even the best developer needs the right tools for the job. Fortunately, Microsoft has given you tools to help you build exciting and useful forms. The Form Design window includes a toolbar, a toolbox, and the actual form you're designing. Other tools are available to help you with the design process, including the Field List and Properties windows.By default, two toolbars appear when you're in a form's Design view: the Form Design toolbar and the Formatting toolbar. The Form Design toolbar has buttons you use to save, print, copy, cut, paste, and perform other standard Windows tasks within the form. It also includes buttons that allow you to toggle the different design windows (such as the toolbox). The Format Painter tool allows you to easily apply all formatting from one control to one or more additional controls. The Build tool invokes the Choose Builder dialog box, from which you can invoke the Expression, Macro, or Code builder. The Formatting toolbar contains tools for graphically modifying the form's properties and objects. You can modify the font, font size, and color of selected objects on the form. With the Formatting toolbar, you can also add bold, underline, and italic or change the alignment; in addition, you can add special effects to the selected objects.
Toggling the Tools to Get What You Want
Many windows are available to help you with the design process when you're in a form's Design view. If you don't have a high-resolution monitor, you'll probably find it annoying to have all the windows open at once. In fact, with all the windows open at once on a low-resolution monitor, the form is likely to get buried underneath all the windows. This is why Microsoft has made each window open and close in a toggle-switch-like fashion. The Form Design toolbar has tools for the Field List, Toolbox, and Properties windows, and each of these toolbar buttons is a toggle. Clicking once on the button opens the appropriate window; clicking a second time closes it.Figure 5.10 shows a form with the Field List, Toolbox, and Properties windows open. Although you can size each of these windows however you like (and you can dock the toolbox to a window edge), the design environment in this low-resolution display is rather cluttered with all these windows open. One of the tricks in working with Access is in knowing when it's appropriate to have each set of tools available. The goal is to have the right windows open at the right time as often as possible.
Figure 5.10. The Form Design toolbar with Design windows visible.

NOTEYou can close the Field List, Toolbox, and Properties windows by using the toolbar buttons. In addition, you can close them by using the Close button on each window, or you can toggle them with the View menu.TIPAccess 2003 offers some handy shortcut keystrokes for working with forms and form properties. In Design view, the F4 key displays the property sheet. When working with a property sheet in Design view, pressing Shift+F7 will shift the focus to the Form Design window while maintaining the focus on the selected control. You can toggle among all available views for a form (Design, Datasheet, Form, PivotTable, PivotChart) by pressing CTRL+> or CTRL+. (period). You can toggle among the different views in the reverse order using CTRL+< or CTRL+, (comma). These shortcut keys are also supported for changing between available views of tables, queries, reports, pages, views, and stored procedures.
Adding Fields to the Form
You can easily add fields to a form by using the Field List window, which contains all the fields that are part of the form's record source. The record source for the form is the table, query, or embedded SQL statement that underlies the form. For example, in Figure 5.10, the form's record source is qryClients. The fields listed in the Field List window are the fields that are part of the query. To add fields to a form, use these two steps:
NOTEA control is an object that you add to a form or report. Types of controls include text boxes, combo boxes, list boxes, and check boxes.NOTETo add multiple fields to a form at the same time, select several qryClients fields from the field list. Use the Ctrl key to select noncontiguous fields, or the Shift key to select contiguous fields. For example, hold down your Ctrl key and click on three noncontiguous fields. Each field will be selected. Next, click a field, hold down your Shift key, and click another field. All fields between the two fields will be selected. If you want to select all fields, double-click the field list title bar. Click and drag any one of the selected fields to the form, and all of them will be added to the form at once.
Selecting, Moving, Aligning, and Sizing Form Objects
You must know several important tricks of the trade when selecting, moving, aligning, and sizing form objects. These tips will save you hours of frustration and wasted time.
Selecting Form Objects
The easiest way to select a single object on a form is to click it. After the object is selected, you can move it, size it, or change any of its properties. Selecting multiple objects is a bit trickier, but you can do it in several ways. Different methods are more efficient in different situations. To select multiple objects, you can hold down the Shift key and click each object you want to select. Each selected object is surrounded by selection handles, indicating that it has been selected.Figure 5.11 shows a form with four selected objects; it's important to understand which objects are actually selected. The ClientID text box, the Company Name label and text box, and the Contact First Name label are all selected; however, the Client ID label and ContactFirstName text box aren't selected. If you look closely at the figure, you can see that the selected objects are completely surrounded by selection handles. The Client ID label and ContactFirstName text box each has just a single selection handle because they're attached to objects that are selected. If you change any properties of the selected objects, the Client ID label and ContactFirstName text box will be unaffected.
Figure 5.11. Selecting objects on a form.

You can also select objects by lassoing them. Objects to be lassoed must be located adjacent to one another on the form. Place your mouse pointer on a blank area of the form (not over any objects) and then click and drag your mouse pointer. You can see a thin line around the objects your mouse pointer is encircling. When you let go, any objects that were within the lasso, including those only partially surrounded, are selected. If you want to deselect any of these objects to exclude them, hold down your Shift key and click the object(s) you want to deselect.One of my favorite ways to select multiple objects is to use the horizontal and vertical rulers that appear at the edges of the Form Design window. Click and drag within the ruler. Notice that as you click and drag on the vertical ruler, two horizontal lines appear, indicating which objects are selected. As you click and drag across the horizontal ruler, two vertical lines appear, indicating the selection area. When you let go of your mouse, any objects within the lines are selected. As with the process of lassoing, to remove any objects from the selection, hold down your Shift key and click on the object(s) you want to deselect.
Moving Things Around
To move a single control with its attached label, you don't need to select it first. Place your mouse over the object and click and drag. An outline appears, indicating the object's new location. When the object reaches the position you want, release the mouse. The attached label automatically moves with its corresponding control.To move more than one object at a time, you must first select the objects you want to move. Select the objects using one of the methods outlined in the previous section. Place your mouse over any of the selected objects and click and drag. An outline appears, indicating the proposed new position for the objects. Release the mouse when you have reached the position you want for the objects.Sometimes you want to move a control independent of its attached label, which requires a special technique. If you click a control, such as a text box, as you move your mouse over the border of the control, a hand icon with five fingers pointing upward appears. If you click and drag, both the control and the attached label move as a unit, and the relationship between them is maintained. If you place your mouse pointer over the larger handle in the upper-left corner of the object, the mouse pointer appears as a hand with only the index finger pointing upward. If you click and drag here, the control moves independently of its attached label and the relationship between the objects changes.
Aligning Objects to One Another
Access makes it easy to align objects. Figure 5.12 shows several objects that aren't aligned. Notice that the attached labels of three of the objects are selected. If you align the attached labels, the controls (in this case, text boxes) remain in their original positions. If you select the text boxes as well, they will try to align with the attached labels. Because Access doesn't allow the objects to overlap, the text boxes end up immediately next to their attached labels. To left-align any objects (even objects of different types), select the objects you want to align and then choose Format, Align, Left or right-click one of the objects and select Align, Left. The selected objects are then aligned (see Figure 5.13). You can align the left, right, top, or bottom edges of any objects on a form.
Figure 5.12. The form before aligning objects.

Figure 5.13. The form after aligning objects.

NOTEDon't confuse the Format, Align feature with the Align tools (Align Left, Center, Align Right) on the Formatting toolbar. The Format, Align feature aligns objects one to the other, but the Align tools on the Formatting toolbar provide justification for the text inside of an object.TIPIt is helpful to add to the toolbar the design tools that you commonly use. For example, you can easily add the Format, Align options to the toolbar. To modify the toolbar, select Tools, Customize. Click to display the appropriate toolbar on the Toolbars tab. You will find the align tools in the Form/Report Design category. Drag and drop the desired tools from the Commands list onto the appropriate toolbar.
Snap to Grid
The Snap to Grid feature determines whether objects snap to the gridlines on the form as you move and size them. This feature is found under the Format menu. If you turn off this feature (it's a toggle), objects can be moved and sized without regard for the gridlines.TIPI prefer to leave the Snap to Grid feature on at all times. I use a special trick to temporarily deactivate the feature when neededI hold down my Ctrl key as I click and drag to move objects. The Snap to Grid setting is then ignored.
Power Sizing Techniques
Just as there are several ways to move objects, you have several options for sizing objects. When you select an object, you can use each handle, except for the handle in the upper-left corner of the object, to size the object. The handles at the top and bottom of the object allow you to change the object's height, and the handles at the left and right of the object let you change the object's width. You can use the handles in the upper-right, lower-right, and lower-left corners of the object to change the width and height of the object simultaneously. To size an object, place your mouse pointer over a sizing handle, click, and drag. You can select several objects and size them all at once. Each of the selected objects increases or decreases in size by the same amount; their relative sizes stay intact.Access offers several powerful methods of sizing multiple objects, found under the Format, Size menu:
- To Fit
Sizes the selected objects to fit the text within them - To Grid
Sizes the selected objects to the nearest gridlines - To Tallest
Sizes the selected objects to the height of the tallest object in the selection - To Shortest
Sizes the selected objects to the height of the shortest object in the selection - To Widest
Sizes the selected objects to the width of the widest object in the selection - To Narrowest
Sizes the selected objects to the width of the narrowest object in the selection
Probably the most confusing of the options is Format, Size, To Fit. This option is somewhat deceiving because it doesn't perfectly size text boxes to the text within them. In today's world of proportional fonts, it isn't possible to perfectly size a text box to the largest possible entry it contains. Generally, however, you can visually size text boxes to a sensible height and width. Use the field's Size property to limit what's typed in the text box. If the entry is too large to fit in the allocated space, the user can scroll to view the additional text. As the following Tip indicates, the Format, Size, To Fit option is much more appropriate for labels than it is for text boxes.TIPTo quickly size a label to fit the text within it, select the label and then double-click any of its sizing handles, except the sizing handle in the upper-left corner of the label.
Controlling Object Spacing
Access gives you excellent tools for spacing the objects on your form an equal distance from one another. Notice in Figure 5.14 that the ClientID, CompanyName, ContactFirstName, and ContactLastName text boxes aren't equally spaced vertically from one another. To make the vertical distance between selected objects equal, choose Format, Vertical Spacing, Make Equal. In Figure 5.15, you can see the result of using this command on the selected objects in Figure 5.14.
Figure 5.14. The form before modifying vertical spacing.

Figure 5.15. The form after modifying vertical spacing.

The horizontal distance between objects can be made equal by choosing Format, Horizontal Spacing, Make Equal. Other related commands that are useful are Format, Vertical Spacing, Increase (or Decrease) and Format, Horizontal Spacing, Increase (or Decrease). These commands maintain the relationship between objects while proportionally increasing or decreasing the distance between them.
Modifying Object Tab Order
The tab order for the objects on a form is determined by the order in which you add the objects to the form. However, this order isn't necessarily appropriate for the user. You might need to modify the tab order of the objects on the form. To do so, select View, Tab Order to open the Tab Order dialog box, shown in Figure 5.16. This dialog box offers two options. Use the Auto Order button to tell Access to set the tab order based on each object's location in a section on the form. However, if you want to customize the order of the objects, click and drag the gray buttons to the left of the object names listed under the Custom Order heading to specify the objects' tab order.
Figure 5.16. Use the Tab Order dialog box to select the tab order of the objects in each section of a form.

NOTEYou must set the tab order for the objects in each section of the form (that is, Header, Detail, or Footer) separately. To do this, select the appropriate section from the Tab Order dialog box, and then set the order of the objects in the section. If your selected form doesn't have a header or footer, the Form Header and Form Footer sections are unavailable.