Partager via


One-To-Many Form Wizard

You can use this wizard to create a data entry form that updates several tables from a single form. For example, you can create one form might update customer and order tables. The size of the form is based on your Maximum design area setting on the Forms tab in the Options dialog box.

To access the One-To-Many Form wizard

  1. From the Tools menu, choose Wizards, and then click Form.
  2. In the Wizard Selection dialog box, choose One-To-Many Form Wizard.

Step 1 – Select Parent Table Fields

In this step, you choose a free table or table or view from a database that will provide the controlling fields data presented in your form. This specifies which field of the parent or controlling table determines the records selected in the child or controlled table.

To select the fields for your form

  1. Use the Databases and Tables controls to locate and select the table you want to use.
  2. In the Available fields window, select one or more fields you want to use from the selected table, and use the arrow buttons to move them to the Selected fields window.

You can select fields from a single table or view only.

Step 2 - Select Child Table Fields

In this step, you choose the fields from the related table. This determines which fields from a child or controlled table are displayed on the form. For example, the parent table might hold only customer names, ID numbers, and addresses, and the child table might hold orders information, such as ID numbers, amount, date, discount, and so on. One customer might have many orders.

As with the parent table fields, you can select fields from a single child table or view only.

Step 3 – Relate Tables

In this step, you specify from the fields list how the parent and child tables are related. In the example from step 2, both tables contain the customer ID field, so that is one way to relate them. There might be other ways depending on the available fields and what you want to report.

Step 4 - Choose Form Style

In this step, you choose the basic format of your form from the styles built into the wizard. When you click any of the styles listed in the Style box, the wizard displays a picture in the magnifying glass as an example of the style.

The button type options refer to your form's navigation buttons. The navigation buttons that the wizard creates on your form are as follows.

  • Text Buttons
    Places navigation text on the buttons of your form.
  • Picture buttons
    Places navigation icons on the buttons of your form.
  • No buttons
    Places no buttons on your form, so you can prevent navigation beyond the displayed or entered data.

**Note   **The Custom button type is unavailable in the One-to-Many Form wizard.

Button Icon Description
Top   Moves record pointer to first record.
Prev   Moves record pointer back one record.
Next   Moves record pointer forward one record.
Bottom   Moves record pointer to last record.
Find   Displays the Search dialog box.
Print   Prints a report.
Add   Adds a new record to the end of the table.
Edit   Allows user to change values in current record.
Delete   Deletes current record.
Exit   Closes form.

Note   After the wizard saves a form, you can add additional fields to it using the same styles by selecting Quick Form on the Form menu.

All controls created by the Form wizard and the Form builder are in Wizards\Wizstyle.vcx. If you want to modify the styles, modify the classes in this file.

Step 5 – Sort Records

In this step, you select in the parent table the fields in the order that you want to sort the records. For example, if you are using two fields and have a first name field and a last name field, then you could choose to sort on first name+last name (such as PaulWilson) or on last name+first name (such as WilsonPaul). How you sort is determined by the order in which you selected those fields.

If your table already has one or more indexes, you can select the index tag, which is listed below the fields, separated by a line, in the Available fields window.

Step 6 - Finish

In this step you can choose how and when to use the form.

  • Save form for later use
    Makes it possible for you to save the form as a file, which you can open later.
  • Save and run form
    Saves the form as a file and then opens it in Visual FoxPro for immediate use.
  • Save form and modify in the Form Designer
    Saves the form as a file and then opens it in the Form designer, so you can modify it.

If you select the Use field mappings check box, then you can use field mappings specified in the Options dialog box of the Tools menu. For more information, see Field Mapping Tab, Options Dialog Box. If you use tables from a database, you can select Override with DBC field display classes so that your form uses information from the database, otherwise this option is unavailable.

To preview the form before exiting the One-To-Many Form wizard, click the Preview button.

See Also

Create One-To-Many Relationships Dialog Box | Form Designer | Wizards Overview | Forms Tab, Options Dialog Box | Creating Persistent Relationships