Understanding the Role of Access Forms and Controls

Access forms create the user interface to your tables. Although you can use Table view and Query view to perform many of the same functions as forms, forms offer the advantage of presenting data in an organized and attractive manner. You can arrange the location of fields on a form so that data entry or editing operations for a single record follow a natural left-to-right, top-to-bottom sequence. You can limit the number of fields that appear on the form, and allow or prevent editing of specific field values. A properly designed form speeds data entry and minimizes operator keying errors.

Forms are constructed from a collection of individual design elements called controls or control objects. An Access form consists of a window in which you place the following classes of Access controls:

  • Bound controls display the data from the table or query that serves as the data source of the form. Access's native bound controls include text boxes, combo and list boxes, subforms, and object frames for graphics. You can bind many Microsoft and third-party ActiveX controls to a form's data source. For example, you can bind the PivotTable, PivotChart, and Spreadsheet controls of the Office Web Components (OWC) to the data source of your form.

  • Unbound dynamic controls, also called calculated controls, can display data from sources other than the table or query that serves as the data source for the form. For example, you can use an unbound text box to display the current date and time.

  • Unbound static controls display, for example, fixed-text labels and logo graphics.

In most cases, you base an Access form on a table or query, which you specify during the initial form design step, to serve as the master data source for your form. This chapter concentrates on creating bound forms with dynamic text-based controls and subforms. A subform is another form contained within a form. The primary use of subforms is to display detail data from a table or query that has a many-to-one relationship with the form's master data source. The ease with which you can link the data in forms and subforms is one of Access's most important advantages over other database front-end platforms, such as Visual Basic 6.0 and Visual Studio .NET.

graphics/new.gif

Access 2003 adds the following new features for forms:

  • Smart tags for form controls. If you specify a smart tag for a table field, the smart tag appears in controls bound to that field. The Show Smart Tags on Forms check box of the Forms/Reports page of the Options dialog determines whether smart tags assigned to table fields appear on forms. Alternatively, you can add smart tags to form text boxes, combo boxes, and other dynamic controls.

    To learn how to apply smart tags to table fields, see "Adding an Internet-Based Smart Tag to a Field," p. 203.


  • Object dependencies of forms. The Object Dependencies task pane page displays objects that the form depends on, such as tables, queries, and subforms. You also can show objects that depend on the form, such as queries that use form control values as WHERE clause criteria.

    For more information on object dependencies, see "Enabling and Viewing Object Dependencies," p. 200.


  • graphics/form_error_autocorrection.gif Form error autocorrection. AutoCorrect's new On Object UI error-checking pop-up buttons indicate the following errors on forms: unassociated labels, invalid or duplicate accelerator key assignments, circular references, and duplicate option (radio button) values.

  • graphics/smart_tag_icon.gif Property value change propagation for forms based on Jet tables and queries. Changes to the following property values of table fields propagate to bound controls of forms and subforms: Description, Format, Decimal Places, Input Mask, IME Mode, IME Sentence Mode, Smart Tags, Column Heads, Column Widths, List Rows, List Width, and Limit To List. When a field property value changes, an Access smart tag lets you choose whether to accept or reject the change to the bound control.

    To enable property change propagation, see "Activating the Access Property Options Smart Tag," p. 203.


  • Windows XP themes for controls. If you want users to be able to apply custom Windows XP themes for form controls, you can enable this feature by marking the Use Windows Themed Controls on Forms check box of the Options dialog's Forms/Reports page. The examples of this chapter don't use XP themes for controls.

  • Combo box list sorting. The Combo Box Wizard has an added sorting step.

graphics/access_2002_new_icon.gif

Access 2002 added PivotTable and PivotChart views of a bound form's master data source. These two form views are identical to those based on Jet or SQL Server queries and are described in Chapter 12, "Working with PivotTable and PivotChart Views." Access 2002 also added about 30 form events. These events primarily are of interest to developers writing VBA event-handling code, and aren't germane to the graphical form design techniques covered in this or the next chapter.

If you're upgrading from Access 97 to Access 2003, following are the form-related features added by Access 2000:

  • Subdatasheets in subforms let you display lower levels of one-to-many relationships in datasheet-style subforms.

  • graphics/access_2002_new_icon.gif In-site subform editing enables simultaneous design mode editing of forms and subforms. The Design view of the subform appears within the region you assign to the Subform view in Run mode. Access 2002 added the Subform in New Window menu choice, which lets you temporarily disable in-situ subform editing.

  • Name AutoCorrect automatically updates your forms and underlying queries for changes to object names, such as altering the name of a field in a table. To take advantage of Name AutoCorrect, you must mark the Track Name AutoCorrect Info check box on the General page of the Options dialog before making changes.

  • Control grouping lets you define a group of controls that you can relocate as a single element.

  • Form view editing lets you change many properties of controls without changing to Design view.

  • Justified and Vertical Alignment options for labels improve the appearance of forms and reports.

  • Added graphics formats let forms apply Web-standard .gif and .jpg files, plus additional graphics file formats, as background images for forms.

Note

The form design techniques you learn in this chapter also apply to designing forms of Access Data Projects (ADP), one of the subjects of Chapter 20, "Exploring Access Data Projects and SQL Server 2000." Forms for ADP are identical in almost all respects to forms that use Jet tables or queries as data sources. The primary differences are ADP's connection to the SQL Server data source (instead of a native Jet connection) and Access's method of storing the forms in an .adp file (rather than in an .mdb file).




Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

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