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 Types of Forms Can I Create, and When Are They Appropriate?


You can design a variety of forms with Microsoft Access. By working with the properties available in Access's form designer, you can create forms with many different looks and types of functionality. This chapter covers all the major categories of forms, but remember that you can create your own forms. Of course, don't forget to maintain consistency with the standards for Windows applications.

Single Forms: Viewing One Record at a Time


One of the most common types of forms, the Single form, allows you to view one record at a time. The Single form shown in Figure 9.1, for example, lets the user view one customer record and then move to other records as needed.

Figure 9.1. A Single form.


Creating a Single form is easysimply set the form's Default View property to Single Form (see Figure 9.2).

Figure 9.2. Setting the form's Default View property.


Continuous Forms: View Multiple Records at a Time


Often, the user wants to be able to view multiple records at a time, which requires creating a Continuous form, like the one shown in Figure 9.3. To do this, just set the Default View property to Continuous Forms.

Figure 9.3. A Continuous form.


A subform is a common use for a Continuous form; generally, you should show multiple records in a subform. The records displayed in the subform are all the records that relate to the record displayed in the main form. Figure 9.4 shows two subforms, each with its Default View property set to Continuous Forms. One subform shows all the orders relating to a specific customer, and the other shows all the order detail items for the selected order.

Figure 9.4. A form containing two Continuous subforms.


Multipage Forms: When Everything Doesn't Fit on One Screen


Scarcity of screen real estate is a never-ending problem, but a multipage form can be a good solution. Figures 9.5 and 9.6 show the two pages of a multipage Employees form. When looking at the form in Design view, you can see a Page Break control placed just before the 3-inch mark on the form (see Figure 9.7). To insert a Page Break control, select it from the toolbox, and then click and drag to place it on the form.

Figure 9.5. The first page of a multipage form.


Figure 9.6. The second page of a multipage form.


Figure 9.7. A multipage form in Design view, showing a Page Break control just before the 3-inch mark on the form.


When creating a multipage form, remember a few important steps:


Tabbed Forms: Conserving Screen Real Estate


A tabbed form is an alternative to a multipage form. Access 97, and all versions of Access subsequent to Access 97, include a built-in Tab control that allows you to easily group sets of controls. A tabbed form could, for example, show customers on one tab, orders for a selected customer on another tab, and order detail items for the selected order on a third tab.

The form shown in Figure 9.8 uses a Tab control. This form, called Employees, is included in the Northwind database. It shows an employee's company information on one tab and his personal information on the second tab. No code is needed to build the example.

Figure 9.8. A tabbed form.


Adding a Tab Control and Manipulating Its Pages

To add a Tab control to a form, simply select it from the toolbox and drag and drop it onto the form. By default, two tab pages appear. To add more tabs, right-click the control and select Insert Page. To remove tabs, right-click the page you want to remove and select Delete Page. To change the order of pages, right-click any page and select Page Order.

Adding Controls to the Pages of a Tab Control

You can add controls to each tab just as you would add them directly to the form. Remember to select a tab by clicking it before you add the controls. If you don't select a specific tab, the controls you add will appear on every tab.

Modifying the Tab Order of Controls

The controls on each page have their own tab order. To modify their tab order, right-click the page and select Tab Order. You can then reorder the controls in whatever way you want.

Changing the Properties of the Tab Control

To change the properties of the Tab control, click to select it rather than a specific page. You can tell whether you've selected the Tab control because the words Tab Control appear in the upper-left corner of the title bar of the Properties window. A Tab control's properties include its name, the text font on the tabs, and more (see Figure 9.9).

Figure 9.9. Viewing properties of a Tab control.


Changing the Properties of Each Page

To change the properties of each page, select a specific page of the Tab control. You can tell whether you've selected a specific page because the word Page is displayed in the upper-left corner of the title bar of the Properties window. Here you can select a name for the page, the page's caption, a picture for the page's background, and more (see Figure 9.10).

Figure 9.10. Viewing properties of a Tab page.


Switchboard Forms: Controlling Your Application


A Switchboard form is a great way to control your application. A Switchboard form is simply a form with command buttons that allow you to navigate to other Switchboard forms or to the forms and reports that make up your system.

The form shown in Figure 9.11 is a Switchboard form. It lets a user work with different components of the database. What differentiates a Switchboard form from other forms is that its purpose is limited to navigating through the application. It usually has a border style of Dialog, and it has no scrollbars, record selectors, or navigation buttons. Other than these characteristics, a Switchboard form is a normal form. There are many styles of Navigation forms; which one you use depends on your users' needs.

Figure 9.11. An example of a Switchboard form.


Splash Screen Forms: A Professional Opening to Your Application


Splash screens add professional polish to your applications and give your users something to look at while your programming code is setting up the application. Just follow these steps to create a Splash Screen form:


  • Create a new form.

  • Set the Scrollbars property to Neither, the Record Selectors property to No, the Navigation Buttons property to No, the Auto Resize property to Yes, the Auto Center property to Yes, and the Border Style to None.

  • Make the form pop-up and modal.

  • Add a picture to the form and set the picture's properties.

  • Add any text you want on the form.

  • Set the form's timer interval to the number of seconds you want the splash screen to be displayed.

  • Code the form's Timer event for DoCmd.Close.

  • Code the form's Unload event to open your main Switchboard form.


  • Because the Timer event of the Splash Screen form closes the form after the amount of time specified in the timer interval, the Splash Screen form unloads itself. While it's unloading, it loads a Switchboard form. The Splash Screen form included in CHAP9EX.MDB is called frmSplash. When it unloads, it opens the frmSwitchboard form.

    You can implement a Splash Screen form in many other ways. For example, you can call a Splash Screen form from a Startup form; its Open event simply needs to open the Splash Screen form. The problem with this method is that if your application loads and unloads the Switchboard while the application is running, the Splash Screen is displayed again.

    TIP

    You can also display a splash screen by including a bitmap file with the same name as your database (MDB) in the same directory as the database file. When the application is loaded, the splash screen is displayed for a couple of seconds. The only disadvantage to this method is that you have less control over when, and how long, the splash screen is displayed.

    Dialog Forms: Gathering Information


    Dialog forms are typically used to gather information from the user. What makes them Dialog forms is that they're

    modal , meaning that the user can't go ahead with the application until the form is handled. Dialog forms are generally used when you must get specific information from your user before your application can continue processing. A custom Dialog form is simply a regular form that has a Dialog border style and has its Modal property set to Yes. Remember to give users a way to close the form; otherwise, they might close your modal form with the famous "Three-Finger Salute" (Ctrl+Alt+Del) or, even worse, by using the PC's Reset button. The frmArchivePayments form in CHAP9EX.MDB is a custom Dialog form.

    TIP

    Although opening a form with its BorderStyle property set to Dialog and its Modal property set to Yes will prevent the user from clicking outside the form (thereby continuing the application), it does not halt the execution of the code that opened the form. Suppose the intent is to open a dialog form to gather parameters for a report, and then open a report based on those parameters. In this case, the OpenForm method used to open the form must include the acDialog option in its Windowmode argument. Otherwise, the code will continue after the OpenForm method and open the report before the parameters are collected from the user.


    / 544