Working with Form Views

3 4

You can open forms in a number of views for entering and editing data, as well as in a view that allows you to modify the form’s design. When you open a form from the Forms group in the Database window, you can click the Open button or the Design button on the Database toolbar (or choose Open or Design from the form’s shortcut menu). Or you can just double-click the form name in the Database window to open it in Form view to work with its data.

Clicking Design opens a form in Design view, where you can add or delete controls and modify various form properties. Clicking Open opens the form in the form’s default view. Figure 5-1 shows the Format tab of the Form properties sheet, with the list of available views dropped down.

figure 5-1. you can choose one of several views as a form’s default view.

Figure 5-1. You can choose one of several views as a form’s default view.

You can set the default view in Design view by selecting one of the following choices for the Default View property of the form:

  • Single Form. Displays one record’s data. This is the default view for new forms.
  • Continuous Forms. Displays several records of data; can be a multirow display.
  • Datasheet. Displays multiple records of data in a datasheet format (similar to a Microsoft Excel worksheet).
  • PivotTable. Displays the form’s data as a PivotTable.
  • PivotChart. Displays the form’s data as a PivotChart.

See Chapter 12, "Using PivotTables and PivotCharts to Analyze Data," for more information on the new PivotTable and PivotChart features.

Access 2002 contains four new properties related to form views: AllowFormView, AllowDatasheetView, AllowPivotTableView, and AllowPivotChartView. These properties replace the old ViewsAllowed property in Access 2000 and earlier, with its more limited choice of Form, Datasheet, or Both. All of these properties are set to Yes by default, and you can adjust these settings as needed. For example, a form that displays name and address data isn’t suitable for PivotTable or PivotChart views. To prevent users from switching to these views if they won’t display well, simply set the form’s AllowPivotTableView and AllowPivotChartView properties to No.

You can switch among enabled views for a form by using the View selector on the Form (or Form Design) toolbar or by choosing options on the View menu. Depending on whether Single Form or Continuous Forms is the selection for a form’s default view, when you open a form from the Database window or switch to Form view by selectingForm on the View selector (or the View menu), you’ll get either the Single Form or Continuous Forms view, whichever was selected as the form’s default view.

note


Continuous Forms is not available as one of the options for switching views, nor does an AllowContinuousFormsView property exist for enabling or disabling this view for a form.

Although you can freely switch among enabled views (other than the Continuous Forms view, as mentioned), a form will look best if it is designed with a specific view (or set of views) in mind. For example, a Single Form view can use as much vertical space as is needed to display all the data in a record (possibly using a tab control to divide the data into pages), whereas a form designed to be displayed in Continuous Forms view rarely has more than two rows of controls. Datasheet forms can’t display controls such as command buttons or option groups, and each record has a single row, so they are best suited to displaying a few columns of data, with minimal interactivity.

Some examples of these forms from the Crafts database on the companion CD are shown later in the chapter. The fpriBooksAndVideos sample (shown in Figure 5-56) is an example of a form that is designed for Single Form view, frmAuthorsContinuous (shown in Figure 5-22) is a Continuous Forms form, and frmBooksBySelectedAuthor (shown in Figure 5-60) is a Datasheet form.

The PivotTable and PivotChart views work best with data that has been preprocessed in a query to select only the data fields needed for the PivotTable or PivotChart (usually a small subset of the fields in the data source).

After the form’s design has been finalized for the view that suits it best, select that view as the default view for the form, and set the AllowView properties to No for the other views to prevent users from accidentally switching to an inappropriate view.



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