Creating a Form from Scratch

You can also create a form from scratch in the Form Design view. This method might seem difficult at first, but Access provides tools, such as the Field list and the Toolbox, to help you create your form. The most powerful and difficult way to create a form is with Form Design view. In this view, you decide exactly where to place each field and how to format it.

To open the Form Design view and create a new form, follow these steps:

  1. From the database window, click the Forms object type.

  2. Click the New button. The New Form dialog box appears (refer to Figure 10.1).

  3. Click Design View .

  4. Select a table or query from the drop-down list at the bottom of the dialog box. The table or query that you select provides a Field list that you can use to place fields on the form.

  5. Click OK . A Form Design window appears (see Figure 10.6). You're ready to create your form.

    Figure 10.6. Form Design view presents a blank canvas for your new form.

    graphics/82fig06.jpg

Notice that a Field list and Toolbox appear in the Form Design view. You work with creating form controls (the equivalent of a field in a table) using these tools in the next section.

You can also start the process of building a form in the Design view by double-clicking the Create Form in Design View link in the database window. Because you are not specifying a table for the Field list to use (as you did in the steps outlined in this section), however, that Field list won't be available. Instead, you must specify a table for the Field list.

graphics/properties.gif To do this, click the Properties button on the Form Design toolbar. The form's properties dialog box appears (see Figure 10.7).

Figure 10.7. The properties dialog box enables you to set a number of properties for the form including the source table.

graphics/82fig07.jpg

In the properties dialog box, be sure that the All tab is selected. Click in the Record Source box, and then use the drop-down arrow that appears to specify the table that will serve as the field source for the form. The Field list appears in the Design View window. Close the properties dialog box.

graphics/tip_icon.gif

Don't See the Toolbox or Field List? graphics/toolbox.gif graphics/fieldlist.gif You need to use the Form Design toolbox and the Field list to help in the design of your form. If they're not visible, click the Toolbox button or the Field List button in the toolbar.


Adding Controls to a Form

The basic idea of the Form Design window is simple: It's similar to a light table or a paste-up board where you place the elements of your form. The fields you add to a form appear in the form's Detail area. The Detail area is the only area visible at first; you'll learn how to add other areas in the next lesson.

graphics/tip_icon.gif

Controls and Fields When you are working with a table, you work directly with fields of data. On forms and reports , you work with controls, which are elements that display data from a field, hold informative text (such as titles and labels), display the results of a formula or calculation, or are purely decorative (such as lines and rectangles).


To add a control displaying a field to the form, follow these steps:

  1. Display the Field list if it's not showing. Choose the Field List from the View menu to do so.

  2. Drag a field from the Field list onto the Detail area of the form. The mouse pointer changes to show that a field is being placed.

  3. Repeat step 2 to add as many fields as you like to the form (see Figure 10.8).

    Figure 10.8. Drag fields from the Field list to the form grid.

    graphics/82fig08.jpg

When you drag a field to a form from the Field list, it becomes a control that displays data from that table field on the form. It is basically a link between the table field and the control on the form. You can drag more than one field to the form at once using the steps described earlier. However, in step 2, rather than clicking and dragging a single field, do one of the following before dragging:

  • To select a block of adjacent fields, click the first one you want and hold down the Shift key while you click the last one.

  • To select nonadjacent fields, hold down the Ctrl key as you click each one you want.

  • To select all the fields on the list, double-click the Field List title bar.

You can move objects around on a form after you initially place them; you'll learn how to do this in the next lesson. Don't worry if your form doesn't look very professional at this point; in the next several lessons, you see how to modify and improve your form.

graphics/tip_icon.gif

Using Snap to Grid If you find it hard to align the fields neatly, choose Snap to Grid from the Format menu to place a check mark next to that command. This forces the borders of the fields included on your form to "snap" to the grid that appears in the Design view. If you want to align the fields on your own, select Snap to Grid again to turn it off.


graphics/save.gif After you have placed all the controls on the form that relate to the fields in a particular table or tables, you are ready to do some data entry. First, however, you must save the form's structure. Click the Save button on the Form Design toolbar. Type a name for the form into the Save As dialog box. Then click OK.



Microsoft Office 2003 All-in-One
Microsoft Office 2003 All-in-One
ISBN: B005HKSHB2
EAN: N/A
Year: 2002
Pages: 660
Authors: Joe Habraken

Similar book on Amazon

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