Training
Certifications
Books
Special Offers
Community




 
Microsoft® Office Access 2003 Inside Out
Author John L. Viescas
Pages 1344
Disk 1 Companion CD(s)
Level Int/Adv
Published 10/29/2003
ISBN 9780735615137
Price $49.99
To see this book's discounted price, select a reseller below.
 

More Information

About the Book
Table of Contents
Sample Chapter
Index
Related Series
Related Books
About the Author

Support: Book & CD

Rate this book
Barnes Noble Amazon Quantum Books

 


Chapter 12: Customizing a Form



In Chapter 11, "Building a Form," you created a form from scratch based on the tblCompanies table in the ContactsDataCopy.mdb sample database. You also had a chance to build a simple form on tblProducts using a wizard. These forms are functional, but they’re not yet professional grade. In this chapter, you’ll learn how to customize your forms to make them more attractive and useful.


NOTE:
The examples in this chapter are based on the forms, queries, tables, and data in HousingDataCopy.mdb on the companion CD included with this book. The results you see from the samples in this chapter may not exactly match what you see in this book if you have changed the sample data in the file. Also, all the screen images in this chapter were taken on a Windows XP system with the display theme set to Windows XP. Your results may look different if you are using a different operating system or a different theme.

Aligning and Sizing Controls

To learn how to customize a form, switch to the HousingDataCopy.mdb sample database. You need a form to edit and display employee data, and the easiest way to get started is to create a blank form based on the tblEmployees table. First, click the Tables button in the Object bar in the Database window. Select the tblEmployees table and choose Form from the New Object toolbar button. In the New Form dialog box, choose Design View, and click OK to start your new form.

Drag down the bottom margin of the Detail area to give yourself some room to work. Click the Format menu and make sure Snap to Grid is not selected. (I’m asking you to do this on purpose so that you can learn ways to line up and evenly space controls.) Open the field list, and drag and drop each field into a vertical column on your form about 1.5 inches from the left edge, beginning with the EmployeeNumber field and ending with the BirthDate field. Your starting point should look something like Figure 12-1 on the next page. (If you don’t want to do the work yourself to get to this point, you can find this form saved as frmXmplEmployee1 in the sample database.)

Figure 12-1.

Figure 12-1. Starting to build a form to display and edit employee data.


NOTE:
The HousingDataCopy.mdb sample database has a special template form called Normal that has its default control properties set to preserve the sunken and etched special effects. This ensures that you’ll see the default sunken text boxes when you follow the exercises in this chapter, even when you’re running on a Windows XP machine with themed controls enabled. You’ll learn more about creating template forms later in this chapter.

If you threw the form together quickly to help you enter some data (as you did in the previous chapter to create a simple Companies input form in the LawTrackDataCopy.mdb database), it probably doesn’t matter if the form doesn’t look perfect. But all the text boxes are the same size, which means some are too large and some are too small to display the data. Also, the labels are different sizes and not right-aligned. Finally, all the text boxes and labels are out of alignment. If you’re designing the form to be used continuously in an application, it’s worth the extra effort to fine-tune the design so that it will look professional and be easy to use.


NOTE:
Even if you follow along precisely with the steps described in this chapter, your results might vary slightly. All the alignment commands are sensitive to your current screen resolution. When your screen driver is set to a high resolution (for example, 1280×1024), the distance between grid points is logically smaller than it is when the screen driver is set to a low resolution (such as 800×600). You should design your forms at the same resolution as the computers that will run your application.

To examine the alignment and relative size of controls on your form, you can open the property sheet in Design view and click various controls. For example, Figure 12-2 shows the property sheets for the EmployeeNumber and the FirstName text box controls. You can see by looking at the values for the Left property (the distance from the left edge of the form) that the EmployeeNumber control is a bit closer to the left margin than is the FirstName control.

Figure 12-2.

Figure 12-2. The properties that define the placement and size of the EmployeeNumber and FirstName text box controls.

You could move around the form and adjust controls so that they fit your data. You could painstakingly enter values for each control’s Left property to get all controls in a column to line up exactly and then set the Top property (defining the distance from the top of the Detail section) for controls that you want to appear in a row. You could also adjust the values for the Width and Height properties so that controls and labels are the same width and height where appropriate. Fortunately, there are easier ways to make all these adjustments.

Sizing Controls to Fit Content

One adjustment you might want to make on this employees form is to boldface the font for all the labels. Remember from the previous chapter that you can click in the horizontal ruler at the top of the design area to select all controls in a column, so do this to select all the label controls on the left. You can then hold down the Shift key and click the Administrator? label that’s not in the column to include it in your selection. Click the Bold button on the Formatting toolbar to change the font in all selected controls.

However, now that you have changed the font, the label controls are no longer large enough to display all the characters, as shown in Figure 12-3 on the next page. (Notice, for example, that the letter y in Employee Number appears clipped off at the bottom.) Also, although all the text boxes and the combo box appear high enough to adequately display the data in the default Tahoma 8-point font, they’re actually too small.

Microsoft Office Access 2003 has a command called Size/To Fit that sizes label controls to fit the width of the caption text in the label. This command also ensures that text boxes and combo boxes are tall enough to display your data using the font size you’ve selected. You can, if you like, select all the controls so that you can resize them all at once. You can choose Select All from the Edit menu to highlight all the controls on your form. To select a specific group of controls, click the first one and then hold down the Shift key as you click each additional control that you want to select. You can also drag the mouse pointer across the form—as long as you don’t start dragging while you are over a control—and the mouse pointer will delineate a selection box. (If you start by clicking on a control and then attempt to delineate other controls by dragging, you’ll only move the control.) Any controls that are inside the selection box when you release the mouse button will be selected. You can also select all controls in a vertical or a horizontal band by making the rulers visible (choose the Ruler command from the View menu) and then dragging the mouse along the top or side ruler.

Figure 12-3.

Figure 12-3. With the boldface font, the label controls are no longer large enough.

After you select the controls you want, choose the Size command from the Format menu, and then select To Fit from the submenu. The Detail section should now look something like that shown in Figure 12-4. (You cannot see the entire Employee Number label because the right end of it is hidden under the EmployeeNumber text box.)


TIP:
You can "size to fit" any individual control or label by clicking the control to select it and then double-clicking any of its sizing handles.

Figure 12-4.

Figure 12-4. The result of sizing all controls to fit.


TIP:
Setting selection options

If you think you’ll select multiple controls often, you might want to experiment with an option setting that governs how you can select controls with your mouse pointer. From the Tools menu, choose Options, and then click the Forms/Reports tab of the Options dialog box. When you select the Partially enclosed option, the selection box you draw with your mouse needs to touch only part of a control to select it. If you select the Fully enclosed option, the selection box must contain the entire control in order for the control to be selected. Fully enclosed is most useful for complex forms with many controls that are close to each other so that you don’t have to worry about inadvertently selecting controls that you touch but don’t fully enclose with the selection box.


INSIDE OUT:
Limitations in use of the Size/To Fit command
The Size/To Fit command works very well to set the height of labels, text boxes, and combo boxes based on the font you have chosen. It also does a reasonable job setting the width of labels based not only on the font but also on the characters you have specified in the Caption property. However, it’s not perfect, so you should be aware of the following:

  • When a label contains a long caption and has a large font that is bold or italic or both, the result of the Size/To Fit command is often not wide enough. You will have to adjust the width manually.
  • The Size/To Fit command does not adjust the width of a text box or combo box because it cannot predict in advance how many characters might need to be displayed from the Control Source property. You must specifically set the width based on the data you expect the control to display.
  • The Size/To Fit command does not work for list boxes. When you switch to Form view, and your list box Row Source contains enough rows to fill the list box, you might find that you see only part of a row at the bottom. (You’ll see only the top part of the characters.) You must switch back and forth between Design view and Form view, adjusting the height of the control manually so that it displays complete rows.

Switch to Form view and scroll through several of the records to get an idea of which controls aren’t wide enough to display the data from the table and which ones could be made narrower. You could painstakingly resize each control to exactly fit what you see in the sample data, but this is a bad idea for two reasons:

  1. The data is a sample of only 15 records, so new data you enter later might be much longer in some fields. You should size the fields that aren’t long enough to be 25% to 50% wider than what you think you need right now.
  2. A form that has a hodgepodge of a dozen or more different control widths won’t make for a very visually pleasing design. You should pick two or three standard widths to use, even if some of the controls end up being wider than necessary.

You can logically group the text box controls and the combo box control in this form into three separate lengths, as follows:

  • Short: EmployeeNumber, DepartmentID, and StateOrProvince
  • Medium: FirstName, MiddleName, LastName, Password, PostalCode, HomePhone, WorkPhone, and BirthDate
  • Long: EmailName, OfficeLocation, Photo, Address, City, and Country


NOTE:
The Photo field in tblEmployees is a text field containing the name of the picture file. In Chapter 23, "Automating Your Application with Visual Basic," you’ll learn how to load the file into an image control using Visual Basic code to display the picture. Also, although you can resize the check box control, the size of the graphic image inside the control doesn’t change.

You can make the necessary adjustments by leaving the medium-length fields as they are and adjusting the fields in the other two groups. First, select the EmployeeNumber control and then hold down the Shift key while you select the DepartmentID and StateOrProvince controls. Next, click the sizing box in the middle of the right edge of one of the controls and drag the right edge to the left until all three controls are about half their original size. Now, click the EmailName control and hold down the Shift key while you select the OfficeLocation, Photo, Address, City, and Country controls. Click the sizing box in the middle of the right edge of one of these controls and drag the edge right until all three controls are about 50% bigger than their original size. Your layout should now look something like Figure 12-5.

Figure 12-5.

Figure 12-5. The form for employee data with the controls sized to better fit the data.

Before you go on, you might want to save the form and name it frmEmployees. You can find the form at this stage saved as frmXmplEmployee2 in the sample database.

Adjusting Control Layout

You could have also used the AutoForm: Columnar Form Wizard to get a jump-start on your employees form. However, that wizard chooses the last AutoForm template you used (Sumi Painting in the last chapter). It also lays out controls in two columns, without any regard to clusters of fields that might work well lined up side by side. Setting up two columns to edit this data is probably a good idea to make better use of the screen space that is wider than it is tall, but by doing it yourself, you can pick which fields go in which column. For example, you might want to place the work-related fields (EmailName, Department, WorkPhone, OfficeLocation, Password, and IsAdmin) in one column, and personal fields (Address, City, StateOrProvince, PostalCode, Country, HomePhone, BirthDate, and Photo) in another.

To adjust your sample employees form in this way, follow these steps.

  1. Stretch the Detail area to about 6 inches wide to give yourself some room to work.
  2. Select as a group the Address, City, StateOrProvince, PostalCode, Country, and HomePhone controls and move them into a new column on the right. You’re going to end up with two fewer controls in the right column than in the left, so line up the Address control opposite the MiddleName control.
  3. Grab the Photo control and move it over under HomePhone opposite Password.
  4. Select the WorkPhone control and move it into the space vacated by Photo.
  5. Move the BirthDate control under Photo and across from IsAdmin (the Administrator check box).
  6. Grab the bottom edge of the Detail section and shrink the section so that it’s now wider than it is high.
  7. Select the Employee Number label, grab the positioning handle in the upper left corner, and move the label to the left out from under the EmployeeNumber text box.

When you’re done, you should have a form design that looks something like the one shown in Figure 12-6. Now you’re ready to fine-tune your form using alignment and control-size adjustments.

Figure 12-6.

Figure 12-6. The employees form after you arrange the controls into columns that make sense.

"Snapping" Controls to the Grid

It’s a good idea to design your form so that all the controls are spaced evenly down the form and all controls in a column line up. One way that you might find convenient to do this is to take advantage of the grid. If you enable Snap to Grid on the Format menu, when you move any control, its upper left corner "snaps" to the nearest grid point. You can use this feature to help you line up controls both horizontally and vertically.

You can adjust the density of the grid by changing the Grid X and Grid Y properties in the property sheet of the form. Be sure that the property sheet is open, and then choose Select Form from the Edit menu. For this example, set the Grid X and Grid Y properties to 16 (0.0625 inch between grid points). This works well for the default 8-point Tahoma font because the "sized to fit" text boxes will be 0.17 inch high. You can place these text boxes every 0.25 inch (four grid points) down the form, which leaves adequate space between the controls. This reduced density also makes it easier to see the grid points so that you can move controls close to the point you want. You could set Grid X and Grid Y to 4, but that reduces flexibility for placing your controls.

The fastest way to snap all controls to the grid is to choose Select All from the Edit menu, choose Align from the Format menu, and then choose To Grid from the submenu. The result might look something like that shown in Figure 12-7.

Figure 12-7.

Figure 12-7. The employees form after you "snap" the controls to the grid.

If you want to position each control individually, enable Snap to Grid by making sure that it is selected on the Format menu. (You’ll see a check mark in front of this command when it is active.) Click each text box, combo box, or check box control and drag it vertically to positions every 0.25 inch (every fourth grid point) down the grid. When you release the mouse button, you’ll see the upper left corner of the control "snap" to the nearest grid point. As you saw in the previous chapter, when you select and move a control that has an attached label, Access moves a control and its label as a unit. If you previously moved a label up or down independent of its attached control by using the positioning handle in the upper left corner, you might need to select either the control or its label and use the positioning handle again to realign each label and associated control.


NOTE:
For a simple form with a few controls, Snap to Grid works well to help you line up controls. For more complex forms, using the Format/Align commands produces a better result. Read the next section to learn about these commands.

Snapping to the grid can help you spread the controls apart to make them easier to work with. You’ll see in the next few steps that it’s easy to line them all up properly.

Lining Up Controls

You now have your controls spaced down the form, but they might not be equally spaced, and they probably aren’t aligned vertically and horizontally. These problems are easy to fix. First, if your form ended up looking like the sample in Figure 12-7 with one or more pairs of controls touching, you need to create some more space by moving down the bottom controls in each column. First, click on the IsAdmin check box at the bottom of the first column to select it and press the Down Arrow key once for each pair of touching controls. (I needed to move the control down two rows of dots in my sample.) Do the same, if necessary, to the BirthDate control at the bottom of the second column. Next, select all the text box controls and the check box control in the first column. You can do this by clicking the first text box control (not its associated label) and then holding down the Shift key as you click each of the remaining controls in the column. Or you can click in the ruler above the controls. Choose Vertical Spacing from the Format menu, and then select Make Equal from the submenu. Finally, choose all the text box controls and the combo box control in the second column, and execute the Make Equal command again.

Now you’re ready to line up the labels. To get started, select all the labels in the left column. (You can do this the same way you selected all the data bound controls in a column.) When you have selected them, your form should look something like the one shown in Figure 12-8. Notice that Access also shows the large positioning handles in the upper left corner of all the related controls but no sizing handles.

Figure 12-8.

Figure 12-8. The employees form with a column of labels selected.

The labels will look best if their right edges align. You have two choices at this point. If you turn off the Snap to Grid command, you can have Access align all the labels with the label whose right edge is farthest to the right, even if that edge is between dots on the grid. If you leave Snap to Grid on, you can have Access align the labels with the label farthest to the right and then snap the entire group to the nearest grid point.


NOTE:
For this example, I left Snap to Grid turned on, but you can try it both ways to see which gives you the best result. Try it with Snap to Grid on, and then click the Undo button on the toolbar and try it with Snap to Grid turned off.

When you’re ready to align the selected labels on your form, choose the Align command from the Format menu, and then select the Right command from the submenu. While you’re at it, click the Align Right button on the toolbar to align the captions to the right edge of all the label controls. Click outside the design area to select the form, which will cancel the selection of the labels. Your form should look similar to the one shown in Figure 12-9.

Figure 12-9.

Figure 12-9. The labels from Figure 12-8 are right aligned.

To further improve the alignment of the controls on the employees form (assuming your form now looks like Figure 12-9), do the following.

  1. The EmployeeNumber text box is a bit too far to the left. Click the control to select it and then click the positioning handle in the upper left corner and drag the control to the right. If you still have Snap to Grid turned on, it should line up with the FirstName control.
  2. Select the EmployeeNumber, FirstName, MiddleName, LastName, EmailName, DepartmentID, OfficeLocation, WorkPhone, Password, and IsAdmin controls. Choose Align from the Format menu, and then select Left from the submenu.
  3. Select the labels in the right column and right align them. Also click the Align Right button on the toolbar to align the captions to the right edge of the label controls.
  4. In my sample, the labels in the right column end up a bit too close to the related data controls. Fixing this is a bit tricky. Select the longest label (State/Province), grab its positioning handle in the upper left corner, and drag it left one row of dots. Grab the sizing handle in the middle of the right edge and expand the label size until it snaps to one row of dots away from the StateOrProvince text box. Now, select all the labels again, align them left, and then align them right. Note that by first setting the right edge of the longest label, then aligning all the labels first to the left, the longest label is now assured to protrude farthest to the right. Thus, when the labels are all aligned right again, they line up at the new right offset of the longest label.
  5. I like all my labels to appear to the left of the related control, so click the Administrator? label to select it, grab its positioning handle in the upper left corner, and drag it to the left of the IsAdmin check box. If you still have Snap to Grid turned on and you do this carefully, the label should line up vertically with the other labels in the column and horizontally with the check box. While you’re at it, click the Align Right button on the toolbar. If you like, click in the Administrator? label and add a colon to the end of the text.
  6. Close up the bottom of the Detail area a bit so that you have the same amount of space below the bottom control as you do above the top control.

After you complete these steps, your form should look something like the one shown in Figure 12-10.

Figure 12-10.

Figure 12-10. The controls and labels are aligned horizontally and vertically.


TIP:
Moving controls in a horizontal or vertical plane

If you want to move one or more controls only horizontally or only vertically, hold down the Shift key as you select the control (or the last control in a group) that you want to move, and then drag either horizontally or vertically. When Access detects movement either horizontally or vertically, it "locks" the movement and won’t let the objects stray in the other axis. If you inadvertently start to drag horizontally when you mean to move vertically (or vice versa), click the Undo button and try again. Moving controls in this way is especially useful when you have Snap to Grid turned off.

If you switch to Form view, you can see the result of your work as shown in Figure 12-11 on the next page. You can find this form saved as frmXmplEmployee3 in the sample database.

Figure 12-11.

Figure 12-11. The employees form with controls aligned and sized.


TIP:
Forms have an Auto Resize property. If you set this property to Yes, Access sizes the Form window to exactly fit the form. Note that Access won’t automatically resize a form if you’ve switched from Design view to Form view. You can set the Auto Center property to Yes to center the Form window in the current Access workspace.

Enhancing the Look of a Form

The employees form you’ve built thus far looks fairly plain. It uses default fonts and a background color that’s inherited from the color you have defined in Windows for 3-D objects (sometimes called the Button Face color). In this section, you’ll learn about additional enhancements you can make to your form’s design.

Lines and Rectangles

Microsoft Access comes with two drawing tools, the Line tool and the Rectangle tool, that you can use to enhance the appearance of your forms. You can add lines to separate parts of your form visually. Rectangles are useful for surrounding and setting off a group of controls on a form.

On your employees form, it might be helpful to add a line to separate the primary information about the employee in the first column from personal information in the second column. To make sufficient room for the line, you should move the controls in the first column to the left. The easiest way to do this is to switch to Design view, select all the affected controls and labels, and then move them as a group. Start by clicking the top ruler just above the right edge of the controls, and then drag in the ruler toward the left until the selection indicator touches all the controls in the left column. (If you can’t see the rulers, be sure that the Ruler command is selected on the View menu.) Release the mouse button, and all the controls and labels in the left column will be selected. To be sure you move all these controls as a group, choose Group from the Format menu. Access shows you that the controls are now grouped by placing a rectangular line around all the controls. Place the mouse pointer over the edge of the group so that the pointer changes to a hand shape (see Figure 12-12), and slide the entire group left a bit.

Figure 12-12.

Figure 12-12. Moving a set of grouped controls.

Next select the Line tool from the toolbox. To draw your line, click near the top of the form between the two columns, about two grid rows below the top edge, and drag toward the form’s bottom edge. If the line isn’t exactly vertical, you can drag the bottom end left or right to adjust it. You can also set its Width property to 0 in the property sheet to make it perfectly vertical. (As you might imagine, setting the Height property to 0 makes the line horizontal.) Use the Line/Border Width button on the toolbar to make the line a little thicker if you want. (Or, change the Border Width property in the Properties window.) Click the down arrow next to the button and choose the border width you want. Your form should now look similar to the one shown in Figure 12-13.


TIP:
When drawing a line on your form, you can make your line exactly horizontal or exactly vertical if you hold down the Shift key as you click and draw the line.

Figure 12-13.

Figure 12-13. Use the Line tool to draw a line on a form; use the Border Width button to adjust the line width.

You can add emphasis to the form by drawing a rectangle around all the controls. To do this, you might first need to move all the controls down and to the right a bit and make the Detail section slightly wider and taller. First, expand your form by about 0.5 inch across and down. Choose Select All from the Edit menu, and then drag all the controls so that you have about 0.25 inch of space around all the edges. (This might seem like too much space, but we’ll use the extra space to have some fun later.) Select the Rectangle tool, click where you want to place one corner of the rectangle, and drag to the intended location of the opposite corner. When you draw a rectangle around all the controls, your form will look similar to the one shown in Figure 12-14.

Figure 12-14.

Figure 12-14. The employees form after a rectangle with a default etched look is added.

Note that the rectangle control actually covers and is on top of all the other controls. However, because the default rectangle is transparent with an etched special effect, you can see the other controls through the rectangle. If you prefer a solid rectangle, you can select the rectangle control and then use the Fill/Back Color button on the toolbar to select the color you want. (A light gray will work best.) When you add a solid control like this after you’ve created other controls, the solid control will cover the previous controls. You can select the control and choose Send to Back from the Format menu to reveal the covered controls and keep the solid control in the background.

Go ahead and make the rectangle a solid light gray and send it to the back. Now switch to Form view, and choose Size to Fit Form from the Window menu. Your employees form should look similar to the one shown in Figure 12-15.

Figure 12-15.

Figure 12-15. The employees form in Form view with a line and a solid rectangle added.

Colors and Special Effects

You can also use color and special effects to highlight objects on your form. For example, you can make all the controls appear to "float" on a raised surface on the form. To do so, switch to Design view and select the rectangle you just created. Use the Special Effect button on the toolbar to change the rectangle from Etched to Raised. Your form will look similar to the one shown in Figure 12-16.

Figure 12-16.

Figure 12-16. The rectangle behind the controls appears raised above the surface of the form background.

Next select the Rectangle tool again, and set Back Color to dark gray and Special Effect to Sunken using the buttons on the toolbar. Draw a second rectangle so that it forms a border about halfway between the edge of the first rectangle and the edge of the grid. Choose Send to Back from the Format menu to send this latest rectangle to the background. Switch to Form view to see the result. The first gray rectangle now appears to float on the form, surrounded by a "moat" of dark gray, as shown in Figure 12-17.

Figure 12-17.

Figure 12-17. The first light gray rectangle appears to float on the form using special effects.

You can find this form saved as frmXmplEmployee4 in the sample database.


INSIDE OUT:
Matching color settings to system colors

Although you can certainly pick from a broad palette of colors for any design object, you might want to design your forms so that they always inherit colors from the options the user has set in the Windows Display dialog box. In fact, if you select the Detail section of the employees form you’ve been building, open the Properties window, and find the Back Color property, you’ll find a strange negative number: -2147483633. This happens to be a special code number that means to use the color set in Windows for button faces and other 3-D objects. Following is a list of color code numbers that you can use to set colors in your forms and controls to match those set in Windows objects:

Code Meaning
–2147483648 Scroll bar color
–2147483647 Desktop color
–2147483646 Color of the title bar for the active window
–2147483645 Color of the title bar for the inactive window
–2147483644 Menu background color
–2147483643 Window background color
–2147483642 Window frame color
–2147483641 Color of text on menus
–2147483640 Color of text in windows
–2147483639 Color of text in caption, size box, and scroll arrow
–2147483638 Border color of active window
–2147483637 Border color of inactive window
–2147483636 Background color of multiple-document interface (MDI) applications (the color of the area under the toolbars in Access)
–2147483635 Background color of items selected in a control
–2147483634 Text color of items selected in a control
–2147483633 Color of shading on the face of command buttons and other 3-D objects
–2147483632 Color of shading on the edge of command buttons
–2147483631 Grayed Text that appears dimmed (disabled) text
–2147483630 Text color on push buttons
–2147483629 Color of text in an inactive caption (a caption in a window that does not have the focus)
–2147483628 Highlight color for 3-D display elements
–2147483627 Darkest shadow color for 3-D display elements
–2147483626 Next lightest 3-D color after the highlight color
–2147483625 Color of text in ToolTips
–2147483624 Background color of ToolTips

Fonts

Another way you can enhance the appearance of your forms is by varying the fonts and font sizes you use. When you select any control that can display text or data, Access makes font, font size, and font attribute controls available on the Formatting toolbar so that you can easily change how the text in that control looks. Click the down arrow next to the Font Name combo box to open a list of all the available fonts, as shown in Figure 12-18. Select the font you want for the control.

Figure 12-18.

Figure 12-18. A partial list of fonts in the Font Name combo box.


NOTE:
The font list shows all fonts currently installed on your computer. Use the Fonts folder in Windows Control Panel to add or remove fonts. A double-T icon next to the font name in the list indicates a TrueType font that is suitable for both screen display and printing. A printer icon next to the font name indicates a font designed for your printer but that might not look exactly the same when displayed on your screen. A font with no icon indicates a font designed for your screen; a screen font might look different when you print it.

If you want to add some variety, you can use bold or italic type in a few key places. In this case, select all the labels on the form and select a serif font such as Times New Roman.

You can add a label to the header of the form to display a title such as Employees. To open up the header and footer of the form, choose Form Header/Footer from the View menu. Grab the bottom edge of the footer and close it up so that it has zero height. Expand the header to give yourself some room to work. Choose the Label tool from the toolbox, draw a label about 1.5 inches wide and 0.5 inches high, type the word Employees in the label, and press Enter. Set the label in the header to the Tahoma font (a sans serif font), bold, italic, and 18 points in size. Double-click one of the sizing boxes to size the control to fit and drag the right edge to the right if all the letters don’t show in the label. You can see a portion of this work under way in Figure 12-19 on the next page.

Figure 12-19.

Figure 12-19. Using font settings in a form header label.

You can create a special "shadowed" effect behind this label in the header by doing the following.

  1. Copy the label you just created to the Clipboard, and paste it in the header.
  2. Change the foreground color of the pasted label to white, and then choose Send to Back from the Format menu.
  3. Turn off the Snap to Grid command on the Format menu, and use the arrow keys to move the white label so that it is slightly lower and to the right of the first label.
  4. Click the Form Header bar to select that section and set the background color to light gray to provide some contrast.

When you finish, the form should look similar to the one shown in Figure 12-20. (You can find this form saved in the sample database as frmXmplEmployee5.)

Figure 12-20.

Figure 12-20. The employees form using some different fonts for variety.


TIP:
A form with too many fonts or font sizes will look busy and jumbled. In general, you should use only two or three fonts per form. Use one font and font size for most bound data displayed in controls. Make label text bold or colored for emphasis. Select a second font for controls in the headers and perhaps a third (at most) for information in the footers.


Next


Last Updated: June 17, 2004
Top of Page

   Contact Us    Free Newsletters   
   © 2004 Microsoft Corporation. All rights reserved. Terms of Use.    Privacy Statement    Accessibility