Partilhar via


Form Wizard

This wizard makes it easy to use a single table to create a form for data entry. The wizard will populate the form automatically with all the fields from the table, so you can delete or rearrange them as you want. The size of the form is based on your Maximum design area setting on the Forms tab in the Options dialog box. Field mapping (what a form displays) is controlled by settings in the Field Mapping tab of the Tools menu, Options dialog box. This tab is not available while the Form wizard is open.

To access the Form wizard

  1. From the Tools menu, choose Wizards, and click Form.
  2. In the Wizard Selection dialog box, choose Form Wizard.

If you create a form within a database, the Form wizard can use input mask and format settings stored in the database. After you save the form, you can open and modify it later like any other form in the Form designer.

Step 1 - Select Fields

In this step, you can choose a free table or a table within a database as the source for your form. You only can select fields from a single table or view.

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.

Step 2 - Choose Form Style

In this step, you specify what the controls on your form will look like. When you click any of the styles listed in the Style text 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.

  • 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.
  • Custom
    Makes it possible for you to choose between two types of scrolling data windows.
    • Scrolling grid - Displays the fields you select from one record at a time.
    • Scrolling grid (justified) – Displays the fields you select from as many records, at one time, as will fit in the form.

The navigation buttons that the wizard creates on your form are as follows.

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   Makes it possible for a user to change values in current record.
Delete   Deletes current record.
Exit   Closes form.

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

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

Step 3 - Sort Records

Select the fields in the order that you would like to sort the records within each group. 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 tag, which is listed below the fields in the Available fields window.

Step 4 - Finish

If you chose a large number of fields earlier and want to make sure they all fit on the form, you can select Add pages for fields that do not fit. Otherwise, if the number of fields exceeds the size of the form, Visual FoxPro provides a scrolling form.

You can use field mappings specified in the Options dialog box of the Tools menu or override those settings with information in the database. To preview the form before exiting the Form Wizard, click the Preview button.

After you save the form, you can open and modify it later like any other form in the Form designer.

See Also

Wizards Overview | Forms Tab, Options Dialog Box | Form Designer