Alison Balteramp;#039;s Mastering Microsoft Office Access 1002003 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Alison Balteramp;#039;s Mastering Microsoft Office Access 1002003 [Electronic resources] - نسخه متنی

Alison Balter

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید



What Form Properties Are Available, and Why Should You Use Them?


Forms have many properties that can be used to affect their look and behavior. The properties are broken down into categories: Format, Data, Event, and Other.

To view a form's properties, you must select the form in one of two ways:

  • Click the Form Selector (the small gray button at the intersection of the horizontal and vertical rulers)

  • Choose Edit, Select Form


Working with the Properties Window


After you have selected a form, click the Properties button on the toolbar to view its properties. The Properties window, shown in Figure 5.30, consists of five tabs: Format, Data, Event, Other, and All. Many developers prefer to view all properties at once on the All tab, but a form can have a total of 107 properties! Rather than viewing all 107 properties at once, try viewing the properties by category. The Format category includes all the physical attributes of the formin other words, the ones that affect the form's appearance (such as background color, for example). The Data category includes all the properties of the data that the form is bound to, such as the form's underlying record source. The Event category contains all the Windows events to which a form can respond. For example, you can write code that executes in response to the form being loaded, becoming active, displaying a different record, and so on. The Other category holds a few properties that don't fit into the other three categories.

Figure 5.30. Viewing the Format properties of a form.


Working with the Important Form Properties


As mentioned, forms have 107 properties, and, of those, 52 are Event properties, covered in Chapter 9. This section covers the Format, Data, and Other properties of forms.

Format Properties of a Form

The Format properties of a form affect its physical appearance. Forms have 31 Format properties, described here.

  • Caption
    Sets the text that appears on the form's title bar. This property can be customized at runtime. For example, you could include the name of the current user or specify the name of the client for whom an invoice is being generated.

  • Default View
    Allows you to select from five available options:

    • Single Form
      Only one record can be viewed at a time.

    • Continuous Forms
      As many records as will fit within the form window are displayed at one time, each presented as the detail section of a single form.

    • Datasheet
      Displays the records in a spreadsheet-like format, with the rows representing records and the columns representing fields.

    • PivotTable
      Displays the records in a Microsoft Excel-type pivot table format.

    • PivotChart
      Displays the records in a Microsoft Excel-type pivot chart format.

    The selected option becomes the default view for the form.

  • Allow Form View
    Prior to Access 2002, Access forms had a property called Views Allowed. The This Views Allowed property determined whether the user was allowed to switch from Form view to Datasheet view, or vice versa. The Default View property determined the initial default display mode for the form, but Views Allowed determined whether the user was permitted to switch out of the default view.

    In Access 2002, Microsoft separated out each type of view as an additional property for the form. Allow Form View specifies whether the user is permitted to switch to the Form view of a form.

  • Allow Datasheet View
    Determines whether the user is permitted to switch to the Datasheet view of a form.

  • Allow PivotTable View
    Determines whether the user is allowed to switch to the PivotTable view of a form.

  • Allow PivotChart View
    Determines whether the user is allowed to switch to the PivotChart view of a form.

  • Scroll Bars
    Determines whether scrollbars appear if the controls on the form don't fit within the form's display area. You can select from vertical and horizontal scrollbars, neither vertical nor horizontal, just vertical, or just horizontal.

  • Record Selectors
    A record selector is the gray bar to the left of a record in Form view, or the gray box to the left of each record in Datasheet view. It's used to select a record to be copied or deleted. The Record Selectors property determines whether the record selectors appear. If you give the user a custom menu, you can opt to remove the record selector to make sure the user copies or deletes records using only the features specifically built in to your application.

  • Navigation Buttons
    Navigation buttons are the controls that appear at the bottom of a form; they allow the user to move from record to record within the form. The Navigation Buttons property determines whether the navigation buttons are visible. You should set it to No for any dialog forms, and you might want to set it to No for data-entry forms, too, and add your own toolbar or command buttons that enhance or limit the standard buttons' functionality. For example, in a client/server environment, you might not want to give users the capability to move to the first or last record, because that type of record movement can be inefficient in a client/server architecture.

  • Dividing Lines
    Indicates whether you want a line to appear between records when the default view of the form is set to Continuous Forms. It also determines whether dividing lines are placed between the form's sections (header, detail, and footer).

  • Auto Resize
    Determines whether the form is automatically sized to display a complete record.

  • Auto Center
    Specifies whether you want the form to automatically be centered within the Application window whenever it's opened.

  • Border Style
    The Border Style property is far more powerful than its name implies. The options for the Border Style property are None, Thin, Sizable, and Dialog. The border style is often set to None for splash screens, which means the form has no border. A Thin border is not resizable; the Size command isn't available in the Control menu. This setting is a good choice for pop-up forms, which remain on top even when other forms are given the focus. A Sizable border is standard for most forms. It includes all the standard options in the Control menu. A Dialog border looks like a Thin border. A form with a border style of Dialog can't be maximized, minimized, or resized. After the border style of a form is set to Dialog, the Maximize, Minimize, and Resize options aren't available in the form's Control menu. The Dialog border is often used along with the Pop Up and Modal properties to create custom dialog boxes.

  • Control Box
    Determines whether a form has a Control menu. You should use this option sparingly. One of your responsibilities as an Access programmer is to make your applications comply with Windows standards. If you look at the Windows programs you use, you'll find very few forms without Control menu boxes. This should tell you something about how to design your own applications.

  • Min Max Buttons
    The Min Max Buttons property indicates whether the form has minimize and maximize buttons. The available options are None, Min Enabled, Max Enabled, and Both Enabled. If you remove one or both buttons, the appropriate options also become unavailable in the Control menu. The Min Max property is ignored for forms with a border style of None or Dialog. As with the Control Box property, I rarely use this property. To make my applications comply with Windows standards, I set the Border Style property, and then inherit the standard attributes for each border style.

  • Close Button
    Determines whether the user can close the form by using the Control menu or double-clicking the Control icon. If you set the value of this property to No, you must give your user another way to close the form; otherwise, the user might have to reboot her computer to close your application.

  • Whats This Button
    The Whats This Button property specifies whether you want the Whats This button added to the form's title bar. This feature works only when the form's Min Max Buttons property is set to No. When the Whats This Button property is set to Yes, the user can click on the Whats This button and then click on an object on the form to display Help for that object. If the selected object has no Help associated with it, Help for the form is displayed, and if the form has no Help associated with it, Microsoft Access Help is displayed.

  • Width
    Used to specify the form's width. This option is most often set graphically by clicking and dragging to select an appropriate size for the form. You might want to set this property manually when you want more than one form to be the exact same size.

  • Picture, Picture Type, Picture Size Mode, Picture Alignment

    , and Picture Tiling
    The Picture properties let you select and customize the attributes of a bitmap used as the background for a form.

  • Grid X, Grid Y
    The Grid X and Grid Y properties can be used to modify the spacing of the horizontal and vertical lines that appear in the form when in Design view. By setting these properties, you can affect how precisely you place objects on the form when the Snap to Grid option is active.

  • Layout for Print
    Specifies whether screen or printer fonts are used on the form. If you want to optimize the form for printing rather than display, set this property to Yes.

  • SubdatasheetHeight
    Used to designate the maximum height for a subdatasheet.

  • SubdatasheetExpanded
    Allows you to designate whether a subdatasheet is initially displayed in an expanded format. When set to False, the subdatasheet appears collapsed. When set to True, the subdatasheet appears in an expanded format.

  • Palette Source
    Determines the source for selecting colors for a form.

  • Orientation
    Allows you to take advantage of language-specific versions of Microsoft Access, such as Arabic. This property can be set to support right-to-left display features for language-specific editions of Access, provided that the underlying operating system supports that language and is 32-bit (for example, Windows 2000).

  • Moveable
    Determines whether the user can move the form window around the screen by clicking and dragging the form by its title bar.


Data Properties of a Form

The 11 Data properties of a form are used to control the source for the form's data, what sort of actions the user can take on the data in the form, and how the data in the form is locked in a multiuser environment.

  • Record Source
    Indicates the Table, Stored Query, or SQL statement on which the form's records are based. After you have selected a record source for a form, the controls on the form can be bound to the fields in the record source.

    NOTE

    The Field List window is unavailable until the record source of the form has been set.

    TIP

    The record source of a form can be changed at runtime. Because of this aspect of the Record Source property, you can create generic, reusable forms for many situations.

  • Filter
    Used to automatically load a stored filter along with the form. I prefer to base a form on a query that limits the data displayed on the form. The query can be passed parameters at runtime to customize exactly what data is displayed.

  • Order By
    Specifies in what order the records on a form appear. This property can be modified at runtime.

  • Allow Filters
    Controls whether records can be filtered at runtime. When this option is set to No, all filtering options become disabled to the user.

  • Allow Edits, Allow Deletions, Allow Additions
    These properties let you specify whether the user can edit data, delete records, or add records from within the form. These options can't override any permissions that have been set for the form's underlying table or queries. Security is covered in Chapters 27, "Database Security Made Easy," and 28, "Advanced Security Techniques."

  • Data Entry
    Determines whether users can only add records within a form. Set this property to Yes if you don't want your users to view or modify existing records but want them to be able to add new records.

  • Recordset Type
    Gives you three options: Dynaset, Dynaset (Inconsistent Updates), and Snapshot. Each offers different performance and updating capability. The Dynaset option creates a fully updateable recordset. The only exceptions to this rule involve records or fields that can't be updated for some other reason. An example is a form based on a query involving a one-to-many relationship. The join field on the one side of the relationship can be updated only if the Cascade Update Related Records feature has been enabled. The Dynaset (Inconsistent Updates) option allows all tables and bound data to be edited. This might result in inconsistent updating of data in the tables involved in the query. The Snapshot option doesn't allow any updating.

  • Record Locks
    Specifies the locking mechanism to be used for the data underlying the form's recordset. Three options are available. The No Locks optionthe least restrictive locking mechanismprovides

    optimistic locking ; that is, Access doesn't try to lock the record until the user moves off it. This option can lead to potential conflicts when two users simultaneously make changes to the same record. The All Records option locks all records underlying the form the entire time the form is open. This is the most restrictive option and should be used only when it's necessary for the form's user to make sure other users can view, but not modify, the form's underlying recordset. The Edited Record option locks a 4KB page of records as soon as a user starts editing the data in the form. This option provides

    pessimistic locking . Although it averts conflicts by prohibiting two users from modifying a record at the same time, it can lead to potential locking conflicts. These three locking options are covered in detail in

    Alison Balter's Mastering Access 2002 Enterprise Development .

  • Fetch Defaults
    New for Access 2002, this property allows you to specify whether defaults for bound fields underlying the form are retrieved when new records are added. When this property is set to No, default values are not retrieved. When set to Yes, default values are retrieved.


Other Properties of a Form

There are additional properties of a form that, although quite powerful, do not fit neatly into any of the other property categories. Microsoft places these properties under the Other properties of the form. They are listed here:

  • Pop Up
    Indicates whether the form always remains on top of other windows. This property is often set to Yes, along with the Modal property, for custom dialog boxes.

  • Modal
    Indicates whether focus can be removed from a form while it's open. When the Modal property is set to Yes, the form must be closed before the user can continue working with the application. As mentioned, this property is used with the Pop Up property to create custom dialog boxes.

  • Cycle
    Controls the behavior of the Tab key in the form. The options are All Records, Current Record, and Current Page. When the Cycle property is set to All Records, the user moves to the next record on a form when she presses Tab from the last control on the previous record. With Current Record, the user is moved from the last control on a form to the first control on the same record. The Current Page option refers only to multipage forms; when the Cycle property is set to Current Page, the user tabs from the last control on the page to the first control on the same page. All three options are affected by the tab order of the objects on the form.

  • Menu Bar
    Specifies a menu bar associated with the form. The menu bar, sometimes referred to as a

    command bar in Access 2003, is created by using the Customize dialog box. Reach this dialog box by choosing Toolbars from the View menu and then selecting Customize. Menus are covered in Chapter 9.

  • Toolbar
    Designates a toolbar associated with the form. The toolbar, sometimes referred to as a

    command bar in Access 2003, is created by using the Customize dialog box. The toolbar you select is displayed whenever the form has the focus. Toolbars are covered in Chapter 9.

  • Shortcut Menu, Shortcut Menu Bar
    The Shortcut Menu property indicates whether a shortcut menu is displayed when the user clicks with the right mouse button over an object on the form. The Shortcut Menu Bar property lets you associate a custom menu with a control on the form or with the form itself. As with a standard menu bar, a shortcut menu bar is created by choosing Toolbars from the View menu and then selecting Customize. Shortcut menus are covered in Chapter 9.

  • Fast Laser Printing
    Determines whether lines and rectangles print along with the form. When this property is set to Yes, you'll notice a definite improvement when printing the form to a laser printer.

  • Help File, Help Context ID
    The Help File and Help Context ID properties are used to associate a specific Help file and topic with a form.

  • Tag
    The Tag property is an extra property used to store miscellaneous information about the form. This property is often set and monitored at runtime to store necessary information about the form. You could use the Tag property to add a tag to each of several forms that should be unloaded as a group.

  • Has Module
    Determines whether the form has a class module. If no code is associated with your form, setting this property to No can noticeably decrease load time and improve your form's performance while decreasing the database's size.

  • Allow Design Changes
    Determines whether changes can be made to the design of the form while viewing form data. If this property is set to All Views, the Properties window is available in Form view, and changes made to form properties while in Form view are permanent if the form is saved.



/ 544