Creating Forms with the Form Wizard

3 4

The Form Wizard offers you several choices for creating forms automatically or semiautomatically, which can save you a good deal of time. Remember that you can always fine-tune a wizard-generated form to get exactly the look you want.

When you use the Form Wizard to create your form, you choose one of several prepackaged form layouts or Design view, which allows you to design the form from scratch. (Don’t worry if the variety of choices looks a bit daunting at first. We’ll look more closely at each view and layout beginning in the next section.) If you choose the Create Form By Using Wizard selection on the Forms tab of the Database window, you can step through the creation of a form based on a table or query, with the following form layout selections:

  • Columnar
  • Tabular
  • Datasheet
  • Justified
  • PivotTable
  • PivotChart

The other method of selecting a form layout is to click New in the Database window to open the New Form dialog box, which offers the following form layout options:

  • Design View
  • Form Wizard
  • AutoForm: Columnar
  • AutoForm: Tabular
  • AutoForm: Datasheet
  • AutoForm: PivotTable
  • AutoForm: PivotChart
  • Chart Wizard
  • PivotTable Wizard
  • Custom Form Wizard

Design View is the do-it-yourself form design choice: A blank form opens in Design view, and you manually place controls on it and set the form’s properties as desired. Choosing Form Wizard offers you the form layout selections in the first list; the first three AutoForm selections in the second list create a form in one of the wizard formats with a single click, as though you had stepped through each page of the wizard and accepted all the defaults.

For more information about the PivotTable and PivotChart selections, see Chapter 12, "Using PivotTables and PivotCharts to Analyze Data."

Except for the PivotTable and PivotChart selections, your choices for form design can be categorized as shown in Table 5-1.

Table 5-1. Form views and layouts

Layout selection Form view Available from Description

Columnar

Single Form

Form Wizard,

Columnar

New Form,

AutoForm: Columnar

Controls are arranged in newspaper-style multiple columns. Displays one record at a time.

Datasheet

Datasheet

Form Wizard,

Datasheet

New Form,

AutoForm: Datasheet

A datasheet similar to an Excel worksheet: no header or footer, and some control types aren’t visible. Displays multiple records simultaneously.

Free-form (Design view)

Usually Single Form, but can be any other view

New Form,

Design View

No controls are automatically placed on the form; you place them where you want them. Displays one record at a time.

Justified

Single Form

Form Wizard,

Justified

Labels are placed above text boxes. Controls completely cover the form background. Displays one record at a time.

Tabular

Continuous Forms

Form Wizard,

Tabular

New Form,

AutoForm: Tabular

Labels are column headings in the form header, and other controls are arranged in columns. Displays multiple records simultaneously.

Top-to-Bottom

Single Form

New Object selector,

AutoForm

Controls are arranged in a single column from top to bottom. Displays one record at a time.

The following sections describe each of the form layout options in more detail, categorizing the available form designs by the views best suited to them.

Single Form View

The wizard selections described in this section allow you to quickly create a form with a specific layout. You can choose AutoForm (except for the Justified option) to create the new form even more quickly, but you need to step through the wizard to fine-tune the layout. For example, you might need to omit specific fields from the form’s record source or select a style for the new form.

Columnar Layout

To create a columnar form in the simplest way, follow these steps:

  1. Select the Forms group in the Database window, and click New on the Database window’s toolbar to open the New Form dialog box. Select a table or query as the form’s data source.
  2. tip


    If another dialog box opens when you click New, you’re probably in another Database window group. Close the dialog box, and click the Forms icon on the Objects bar to go to the Forms group.

  3. Select AutoForm: Columnar, as shown in Figure 5-2, and click OK.
  4. figure 5-2.choose autoform: columnar to create a columnar form.

    Figure 5-2. Choose AutoForm: Columnar to create a columnar form.

  5. The new form opens, as shown in Figure 5-3.
  6. figure 5-3.the columnar autoform has three columns of controls.

    Figure 5-3. The columnar AutoForm has three columns of controls.

The controls are laid out in three columns. Unfortunately, the layout doesn’t usually allow enough size to show the entire label captions—you’ll have to do some fine-tuning to make a usable form.

See Chapter 6, "Working with Form Controls," and Chapter 8, "Using Design Tools," for more details on resizing and rearranging controls on forms.

Selecting Form Styles

When you use the Form Wizard to create a new form, the wizard uses the format you’ve selected in the AutoFormat dialog box. If the style of your new form doesn’t appeal to you, open the AutoFormat dialog box, and select another style, as shown in Figure 5-4.

figure 5-4. you can choose a more suitable format for your form in the autoformat dialog box.

Figure 5-4. You can choose a more suitable format for your form in the AutoFormat dialog box.

The Standard format (shown in Figure 5-3), which has the most conservative appearance, is generally the best choice for business forms. If you want a more extensive choice of conservative color schemes, follow these steps to create your own scheme and save it to one of the named schemes in the AutoFormat dialog box:

  1. Change the form’s background color, control background, control text color, and control fonts to the colors and style you prefer.
  2. Open the AutoFormat dialog box, and select a named format (Stone, for example).
  3. Click Customize, select Update 'Stone’ With Values From The Form, and click OK. (See Figure 5-5.)

    figure 5-5.you can save a custom format to one of the autoformat selections.

    Figure 5-5. You can save a custom format to one of the AutoFormat selections.

Now you can apply your custom color scheme (in this example, a light blue background, bold labels, and Verdana text boxes) to any form by selecting the Stone AutoFormat. Alternatively, you can use the Design Schemes add-in (Design Schemes.mda, available on the companion CD) to apply one of a set of four conservative formats to a form, or create your own custom format in more detail than the Customize AutoFormat dialog box allows.

For more information about the Design Schemes add-in, see Chapter 15, "Using Add-Ins to Expand Access Functionality."

Justified Layout

To create a form with the Justified layout, follow these steps:

  1. Double-click the Create Form By Using Wizard selection in the Database window, or click New to open the New Form dialog box.
  2. Select the table or query you want to use as the form’s data source, select the Form Wizard option, as shown in Figure 5-6, and then click OK.

    figure 5-6.select the form wizard in the new form dialog box to create a form with a justified layout.

    Figure 5-6. Select the Form Wizard in the New Form dialog box to create a form with a Justified layout.

    note


    No AutoForm selection exists for creating a Justified Form.

  3. Select the fields you want on the form, as shown in Figure 5-7, and click Next.

    figure 5-7.the form wizard lists available fields for a justified form.

    Figure 5-7. The Form Wizard lists available fields for a Justified form.

  4. Select the Justified option, as shown in Figure 5-8. Click Next.

    figure 5-8.select the justified option in the form wizard for a justified layout.

    Figure 5-8. Select the Justified option in the Form Wizard for a justified layout.

  5. Select a style for the form, as shown in Figure 5-9. Click Next.

    figure 5-9.you can select from a variety of decorative styles for the form.

    Figure 5-9. You can select from a variety of decorative styles for the form.

  6. On the last page of the wizard, give the form a title (caption), as shown in Figure 5-10, and click Finish. The title will also be used as the form’s name.

    figure 5-10.give the form an appropriate title.

    Figure 5-10. Give the form an appropriate title.

If you want to give the form the frm tag or some other identifier in accordance with a naming convention, you’ll have to do this later by renaming the form in the Database window. See Chapter 4, "Creating a Database," for more details about using a naming convention.

Figure 5-11 shows the finished form, which looks somewhat like a fill-in-the-blanks paper form with labels positioned over the text boxes.

figure 5-11. the finished justified form looks like this.

Figure 5-11. The finished Justified form looks like this.

The Justified layout is attractive, but it has one serious drawback: If you find that some of the text boxes are the wrong size, resizing and rearranging the controls to preserve the justified appearance is quite time-consuming.

InsideOut

Suppose you like one of the wizard’s layout selections but you want to modify it in some way. For example, you might want the labels in the Justified layout to use a smaller font size. Unfortunately, there’s no way to accomplish this in the interface because the wizard code is encrypted and doesn’t let you modify its form templates. Unlike Word, Access doesn’t allow users to modify the wizard’s layout selections. However, there is a workaround: If you want to create a custom form style to apply to your forms, you can use my Design Schemes add-in, which is available on the CD.

Top-to-Bottom Layout

A form created by using the New Object: AutoForm selection has its fields laid out from top to bottom (see Figure 5-12) in a manner that isn’t very attractive for general use but makes an effective quick data entry form to use for focused data entry.

figure 5-12. this new form was created by using the autoform selection.

Figure 5-12. This new form was created by using the AutoForm selection.

See the sections "Creating Quick Data Entry Forms," and "New Record Forms," for more details about quick data entry forms.

If you create an AutoForm based on a table by highlighting the table on the Tables tab of the Database window and then clicking New Object: AutoForm on the Database Design toolbar (see Figure 5-13), your new form will open in Single Form view.

figure 5-13. you can create a form in single form view by clicking the autoform selection on the toolbar.

Figure 5-13. You can create a form in Single Form view by clicking the AutoForm selection on the toolbar.

Continuous Forms View

When you need to view or edit only a handful of fields, Continuous Forms view can be an ideal choice because it lets you see several records at the same time. You place controls where you want them, so you have the option of creating a multirow display, unlike Datasheet view, which has one row per record. One of the Form Wizard selections (Tabular Form) creates a single-row form in Continuous Forms view. No Form Wizard selection exists for multirow forms, but you can simply make the detail section taller and rearrange the controls so they form two rows in Continuous Forms view.

Tabular Layout

To create a tabular form while specifying which controls are displayed on the form, follow these steps:

  1. Open the New Form dialog box, and select a table for the form’s record source.
  2. Select Form Wizard, as shown in Figure 5-14, and click OK. (Alternatively, you can double-click Create Form By Using Wizard in the Database window.)

    figure 5-14.select form wizard in the new form dialog box.

    Figure 5-14. Select Form Wizard in the New Form dialog box.

  3. On the first page of the Form Wizard, select the fields to use in the tabular form, as shown in Figure 5-15. Bear in mind that you can’t use more fields than can be displayed in a single page width. Click Next.

    figure 5-15.select fields for a tabular form on the first page of the form wizard.

    Figure 5-15. Select fields for a tabular form on the first page of the Form Wizard.

  4. Select the Tabular layout, as shown in Figure 5-16. Click Next.

    figure 5-16.select the tabular layout for a new form to arrange information in table format.

    Figure 5-16. Select the Tabular layout for a new form to arrange information in table format.

  5. Select a style for the form, as shown in Figure 5-17. Click Next.

    figure 5-17.choose from a variety of styles for the new tabular form.

    Figure 5-17. Choose from a variety of styles for the new tabular form.

  6. Give the form a title, as shown in Figure 5-18. (The title is the caption that appears in the form’s title bar and is also used as the form’s name.) By default, the form will be opened in Form view, but you can select Modify The Form’s Design to open the form in Design view. Click Finish.

    figure 5-18.give the form a title on the last page of the form wizard.

    Figure 5-18. Give the form a title on the last page of the Form Wizard.

Figure 5-19 shows the new tabular form.

figure 5-19. the finished tabular form looks like this.

Figure 5-19. The finished tabular form looks like this.

Form Names, Titles, and Captions

Access forms have names (listed in the Database window) and captions (displayed as text in the form’s title bar). You can examine and change a form’s caption by using the Caption property on the All tab of the form’s properties sheet, as shown in Figure 5-20. However, you can’t change a form’s name in its properties sheet (although this is possible with other types of Office forms) because no Name property is displayed there.

Figure 5-20. A form’s <i>Caption</i> property is located on the All tab of its properties sheet.

Figure 5-20. A form’s Caption property is located on the All tab of its properties sheet.

The Access Form Wizard uses the term title on the last page of the wizard. This can be confusing because forms don’t have a Title property. Whatever text you enter as the form’s title will be used as both its caption and its name. That presents a problem for users who want to name their database objects in accordance with a naming convention, such as the Leszynski Naming Convention (LNC) discussed in Chapter 20, "Customizing Your Database Using VBA Code."

If you use the LNC naming convention for database objects, a form should generally have a name starting with the frm tag. If you give the form the title frmAuthors in the Form Wizard, the form’s title bar will display frmAuthors, which looks strange. If you want Authors as the form’s caption and frmAuthors as the form’s name, you have to give the form the title Authors in the wizard and then rename it frmAuthors in the Database window, as shown in Figure 5-21. To rename a form in the Database window, select the form name, press F2 to switch to edit mode, edit the name as desired, and press Enter.

figure 5-21. you can rename a form in the database window.

Figure 5-21. You can rename a form in the Database window.

Alternatively, you can give the form the title frmAuthors in the wizard and then change the caption to Authors in the form’s properties sheet.

Multirow Continuous Forms Layout

A tabular form has some resemblance to a form in Datasheet view because it is laid out in columns, but a form in Continuous Forms view isn’t restricted to a single row of fields per record—you can have several rows of controls in the detail section of a form. A multirow continuous form is a good format choice when you want to display multiple records of data at once but you have more controls than can be displayed in a single row, or you need to use controls that aren’t supported in Datasheet view.

For example, if you wanted an Authors form similar to the tabular form shown in Figure 5-19 but with a large Notes control bound to a Memo field, you could create a form in Continuous Forms view, laid out as in Figure 5-22.

figure 5-22. use a form in continuous forms view if you need to display more controls than datasheet view allows.

Figure 5-22. Use a form in Continuous Forms view if you need to display more controls than Datasheet view allows.

Datasheet View

The Datasheet view of a form looks like a worksheet, which makes it suitable for displaying columnar data. However, forms in Datasheet view have a number of limitations that you should take into account before selecting this option:

  • Command buttons, option groups, and most controls other than text boxes and combo boxes won’t appear in the Datasheet view of a form.
  • Datasheet forms have no header or footer.
  • Datasheet forms can display only a limited number of fields per record (fewer than other form views can display).

Datasheet Form Layout

You create a datasheet form much the same way you create a tabular form; the only difference is that you select the Datasheet option on the layout page of the Form wizard. You can also create a datasheet form by selecting the AutoForm: Datasheet option in the New Form dialog box, but unless your data source has only a few fields, this selection will most likely produce a form with too many narrow columns.

Figure 5-23 shows a datasheet form created by selecting a few fields from tblSources and selecting the Ricepaper style for the form.

figure 5-23. a typical datasheet form looks like this.

Figure 5-23. A typical datasheet form looks like this.

InsideOut

As you can see in Figure 5-23, there’s no visible evidence of the Ricepaper style in the datasheet. No matter what style you select when you’re creating the form, the datasheet will appear in whatever style you have selected on the Datasheet tab of the Options dialog box, as shown in Figure 5-24. Unless you change these settings, your datasheet will have black text on a white background. However, if the form can be displayed (and looks good) in both Single Form and Datasheet views, the Ricepaper style will be visible when you switch to Single Form view.

figure 5-24. you can set datasheet appearance options on the datasheet tab of the options dialog box.

Figure 5-24. You can set datasheet appearance options on the Datasheet tab of the Options dialog box.

figure 5-25. this northwind form has two datasheet subforms.

Figure 5-25. This Northwind form has two datasheet subforms.

tip


To quickly place a subform on a form, simply open the main form in Design view and drag the form that is to be the subform onto it.



Microsoft Access Version 2002 Inside Out
Microsoft Access Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612838
EAN: 2147483647
Year: 2005
Pages: 172
Authors: Helen Feddema

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