Using the Form Wizard

Let's turn now to the Form Wizard to see how you can use it in your work.

You might find the Form Wizard slightly less useful than the Report Wizard. With a report, it's great to let Access do all the grunt work, especially the arduous task of creating groups and their summary controls. Even if the final product is not exactly what you want, it's often good enough (with a little tweaking) for your intended audiencethe information is all there.

A form, on the other hand, is something you might use every day to enter values. You want the controls, the tab order (discussed in Chapter 6), the design, and so on to be just right for easy data entry. An AutoForm is often fine for quick data entry, and you can always add a combo box or two to make life simpler. More advanced forms might require outside assistance from a database consultant who can automate your work by doing some programming. The Form Wizard might fall uncomfortably between these two ends.

But I could be wrong in this bias, at least for your own situation. As with the Report Wizard, the Form Wizard enables you to easily combine fields from different tables, add one or more subforms, and apply form styles.

To try the Form Wizard, let's try to create a form similar to the Orders form you've been using.


In the Database window, click Forms and click New. Select Form Wizard and click OK.


Open the Tables/Queries drop-down list and choose tblCustomers. Double-click CustLastName, CustFirstName, CustStreet Address, CustCity, CustState, CustZIP, and CustFax to add them to the Selected Fields pane.


Open the Tables/Queries drop-down list and select tblOrders. Add OrderID, ShippedDate, ShipID, Overnight, and ShipCost to Selected Fields.


Open the Tables/Queries drop-down list and select tblShippers. Double-click ShipCompanyName to add it to Selected Fields.


Open the Tables/Queries drop-down list and select tblOrderDetails. Use the double-arrow button to add all four fields to Selected Fields.

In this initial dialog box, the most logical choice would actually have been to select all the fields from qryOrders, on which the Orders form was built. But perhaps the main advantage of the wizard is that you can add fields from any table and have Access give you various options on how the data should be presented. To demonstrate this advantage, I had you add the fields separately from each table.


Click Next.

In this dialog box, depending on the relationships among the fields you've chosen, Access offers various ways to present your data. The current selection is tblCustomers. If you choose to view your data by customer, the orders for each customer would be in a subform, and the order details for each order would be in a second subform. This makes sense: One customer can have many orders, and each order can have many detail records. So you have a hierarchy of one-to-many relationships. (If you find this confusing, when you're finished with the wizard, choose Tools, Relationships and review the relationships in the window.)


Click by tblShippers.

Each shipper can handle many orders, and each order can have many order detail records. So you have another hierarchy of one-to-many relationships that can be displayed with a main form and two subforms.


Click by tblOrderDetails.

The relationships in this table are always on the "many" side, so the form would just show all the fields together. This choice is unlikely because it doesn't organize your data meaningfully.


Click by tblOrders (see Figure 11.21).

Figure 11.21. In this crucial dialog box of the Form Wizard, your choices for form/subforms derive from the relationships among the chosen tables.

This displays the relationship you've been using in this chapter. Each order can have many order detail records, which are displayed in a subform.

Note that you have a choice between Form with Subforms and Linked Forms. With linked forms, no subforms would appear on the form. Instead, there would be a button for you to open and view the related order detail records. If you think that you'll need to view the order details only infrequently, this choice would maintain the focus on the fields in the main form and save space.


With by tblOrders and Form with Subforms selected, click Next.


In this dialog box, you choose a layout for the subform. Keep the Datasheet selection and click Next.


In this dialog box, you choose a style. For comparison with the frmOrdersPractice form, use the same Standard style. Click Next.


Name your form frmOrdersWizard. Name the subform frmOrderDetailsWizard Subform. Leave the other options as they are, and click Finish.


Compare your form to frmOrdersWizard in the NiftyLions EndChap11.mdb database.

The form/subform you created resembles the frmOrdersPractice form/subform. It has the same fields in the main form, albeit in a different order than in frmOrdersPractice. However, it doesn't have the useful tools you added during this chaptercombo box, list box, option groupthat would make the form more efficient to use.


Close the form and subform and save all your changes.

Hands-On Microsoft Access(c) A Practical Guide to Improving Your Access Skills
Hands-On Microsoft Access: A Practical Guide to Improving Your Access Skills
ISBN: 0321245458
EAN: 2147483647
Year: 2005
Pages: 169
Authors: Bob Schneider © 2008-2017.
If you may any questions please contact us: