Using Forms

Description

Forms provides a detailed, one-record-at-a-time view of data in a table or set, and are most commonly used for data entry. Forms also make it easy to enter and modify data stored in multiple tables in a database. In this lesson, you learn how to create and use basic Forms.

 Working With Forms

In addition to the Default Browse for entering data, Alpha Anywhere also provides a Default Form that you can use for data entry. Working in Form view is like working in browse view; you can perform the same operations, including entering, editing, deleting, and sorting records. The toolbars are very similar and the menus offer most of the same features. In form view, you can use the same navigation options to display and navigate records, that you use in Browse view.

 Using the Form Editor

In the first procedure, you examine a Default Form in AlphaSports and modify it using the Form Editor. Using the Form Editor, you can insert fields, display calculations, and add graphics and other design elements. To open an AlphaSports Default Form :

  1. Open the AlphaSports database.

  2. In the Control Panel, right-click on the Customer table, and select Open Default Form from the right-click menu. The Customer table Default Form appears.

    • The Default Form displays the field values of one record, with each field on a separate line.

      Press F8 to switch between form view and browse view.
  3. Click the following or select Form > Design Mode.

  4. The Customer Default Form appears in the Form Editor.

    • The Form Editor displays the Form fields and field names arranged in a vertical layout.

  5. In addition to the Form Editor, the Toolbox appears. If the rulers are not present, select View > Rulers to display them.

  6. To aid in form design, select Form > Grid. The Grid dialog box appears.

  7. Select Show Grid, and click OK.

 Using the Form Design Toolbar

The Form Design toolbar contains commands and options that let you create and modify the structure and appearance of a form.

The following table describes the functions of the Form Design toolbar buttons.

  • Display table records in Form view.

  • Create a new Form.

  • Open an existing Form.

  • Save the Form layout.

  • Print Form data.

  • Preview Form data.

  • Define print settings; for example, printer, # of copies, and page orientation.

  • Remove the selected information (cut) and copies it to the clipboard.

  • Copy the selected information to the clipboard.

  • Insert (paste) clipboard contents at the cursor position.

  • Delete the selected object(s).

  • Undo an action.

  • Redo an action.

  • Define Form or object properties.

  • Define Form or object events.

  • Display rulers.

  • Display Toolbox floating toolbar.

  • Display DragDrop List window for inserting objects on the Form.

  • Toggle Text Toolbar on and off.

  • Toggle Border Toolbar on and off.

  • Toggle Arrange Toolbar on and off.

  • Toggle Copy Format Toolbar on and off.

  • Group selected objects together as a single unit.

  • Un-group selected object(s).

  • Create or modify calculated fields.

  • Create or modify variables.

  • Display the Control Panel.

In the following procedures, you learn to move, edit, delete, resize, format, and add Form objects.

 Editing the Default Form

To edit a form object, you must first select it by clicking on it. When you select an object, selection handles appear, small black boxes in each corner and one at the center of each side. You can select more than one object by using one of the following procedures.

  • Holding down the Shift key while clicking the objects.

  • Holding down the left mouse button and dragging to draw a rectangle (lasso) through or around the objects.

  • Select all objects on the form, by selecting Edit > Select All, or pressing Ctrl+A.

To edit the Customer Default Form :

  1. Open the form, and click the  button on the toolbar. The Customer Default Form appears in the Form Editor. In modifying the Default Form, you arrange the form fields into two columns. In the next steps, you resize the form to accommodate both columns.

  2. Position your cursor over the right edge of the Form Editor window. The cursor becomes a two-headed, horizontal arrow.

  3. Click and drag the right edge of the window to the right, past the eight inch mark on the ruler.

  4. Position your cursor over the right edge of the form.

  5. Click and drag the right edge of the form to about eight inches, to widen the form.

  6. Click on the Customer ID field. If the objects are grouped, selection handles appear around the Customer ID field and title.

    • Note that when the fields are grouped, and you click a second time on one of the fields, black selection handles appear around the object you clicked, and grey selection handles appear around the other object or objects.

    • You have selected an individual object within the group. You can then right-click on the individual object, and examine its properties and events. This is called drilling down within a group. If you right-click on a group of objects, you can only examine the properties common to the group. If you ungroup and then select both label and field, black selection handles appear separately around each object.

You can specify the following Alpha Anywhere setting to group fields and titles, however, this setting has no effect on the current form.

  1. Select View > Settings.

  2. Expand the System settings, and click Styles.

  3. Select Forms under Layout Type, and select Automatically Group Fields & Titles.

  4. Click OK. Use the Shift key to group the fields and titles that you reposition in the following steps.

  5. Click on the grouped Customer ID field and title text, and drag them to the upper right corner of the form.

  6. To move a field in small increments, press the Shift key and use the Up and Down arrows.

  7. Using the following screen shot as a guide, select the fields and move them to new locations.

  8. Select Edit > Select All, and click Arrange > Ungroup (or on the toolbar). The field and label title objects appear selected separately.

  9. Delete the field title objects for Bill Postal Code and Bill Country, by selecting them, and pressing the Delete key.

  10. Place the data fields next to the Bill State/Region field.

  11. Repeat steps 9 and 10 for the Shipping Postal Code and Country. Leave space near the top of the form for a title, and in between the billing address group of fields and the shipping address group. In the next steps, you edit and resize a text label object.

  12. Double-click on the Billing Address? text field. The text becomes highlighted and editable. You can also make text changes by right-clicking on the text object, and selecting Properties from the right-click menu.

  13. Enter "Shipping Same as Billing?". In the next step, you enlarge the text field to accommodate the new label text.

  14. Select the Shipping Same as Billing label field. Selection handles appear around the object.

  15. Position the cursor over the left-side selection handle. The cursor becomes a two-headed, horizontal arrow.

  16. Click and drag to the left, to enlarge the text field.

  17. Click Save, enter the name "CustomerList", and click OK.

In the next sections, you use other Design toolbar options to align, format, and add a new object to the Form.

 Aligning Objects

The Align Positions, Align Sizes, and Align Spaces commands, also found in the Arrange menu, let you align multiple objects' positions, sizes, and spaces. You access the Arrange Toolbar by clicking the Toggle Arrange Toolbar button . The Arrange Toolbar appears below.

The Align Positions command has the following options. When two or more objects are aligned, the first selected object stays put, and the others move into alignment with it.

  •  Left

    Align selected objects to the left edge of the first selected object.

  •  Right

    Align selected objects to the right edge of the first selected object.

  •  Top

    Align selected objects to the top edge of the first selected object.

  •  Bottom

    Align selected objects to the bottom edge of the first selected object.

  •  Center width

    Move selected object horizontally, so they are centered using the first selected object as the point of reference.

  •  Center height

    Move selected object vertically, so they are centered using the first selected object as the point of reference.

The Align Sizes command has the following options. When you size two or more objects, the first selected object stays the same, while the rest change.

  •  Width

    Resize objects so they are as wide as the first selected object.

  •  Height

    Resize objects so they are the same height as the first selected object.

  •  Size

    Resize objects so they are the same size as the first selected object.

The Align Spaces command has the following options. When you adjust spacing between objects, the spacing between the first two objects remains the same, while the others are moved.

  •  Horizontal

    Move objects horizontally, creating an equal amount of space between them, left to right.

  •  Vertical

    Move objects vertically, creating equal space between them, top to bottom.

To align form objects:

  1. Open the AlphaSports database.

  2. In the Control Panel, select the Forms tab.

  3. Right-click the "CustomerList" form, and select Design from the right-click menu. The CustomerList form appears in the Design Editor.

  4. Click the Toggle Arrange toolbar button. The Arrange Toolbar appears.

  5. Hold down the Shift key and select the following label text fields: First Name, Last Name, Bill Address 1, Bill Address 2, Bill City, and Bill State/Region.

  6. On the Arrange Toolbar, click the Right Align button . The selected label fields appear aligned by their right edges.

  7. Select the corresponding field objects, and click the Left Align button . The selected label fields appear aligned by their left edges.

    • Similarly, right and left align the Company, Phone Number, Fax Number, and Shipping Same as Billing? label text fields and field objects.

    • In the next procedure, you add a title and border to the form.

 Creating Form Objects

First, you use the Toolbox floating toolbar to create a title text object for the form, then you use the Text Toolbar to format its appearance. The Text Toolbar is a shortcut for some commonly used formatting options. To access all the options, right-click on the object, and select Properties. The Toolbox is a floating toolbar that contains buttons representing the objects you can place inside a form. You can also select Object > New to select and create an object for a form. To display the Toolbox :

  1. Click the Toolbox button on the Toolbox, or select View > Toolbox.

    • The following image shows the Toolbox, which has the same functionality.

    • The following table lists the Toolbox tools and describes their function.

In the next procedure, you add a form title, in the top area of the CustomerList form, by adding and formatting a text object. To add a form title:

  1. Open the CustomerList form in Design Mode. The CustomerList form appears in the Design Editor.

  2. Click the Toolbox button, or select View > Toolbox. The Toolbox floating toolbar appears.

  3. If you do not have space at the top of the CustomerList form, select the Vertical Shift tool.

  4. The Horizontal Shift and Vertical Shift tools let you insert space in your layout by moving groups of objects horizontally or vertically.

  5. Click above the First Name field in the form, and drag the fields downward.

    • The Vertical Shift tool selects and moves all the fields below the bar downward. The Vertical Shift tools select the fields in the direction of the first mouse movement. Nudge downward to select fields below the Vertical Shift tool bar, or upward to select fields above the bar. Once selected, you can move the fields in the opposite or same direction. Another way to select and reposition multiple fields at one time, is by using the rulers. When you left-click in the top or side ruler, a line appears on the form. The line selects and can move all the objects it touches. If you right-click in a ruler, you can use the right-click menu options to align the objects that the line touches.

  6. Select the Text object tool from the Toolbox, and position the mouse pointer in the Form Editor window. The mouse pointer becomes a cross-hair connected to the letter A.

  7. Draw a rectangle with the tool, to establish the location and dimensions of the text object. When you release the mouse button, the cursor is positioned inside the text object, where you can enter the title text.

  8. Enter the text "Customer List" and click outside the text object frame.

  9. Click the Selection tool on the Toolbox, and select the text object. Selection handles appear around the title text object.

  10. Click the Text toolbar button to display the Text Toolbar.

  11. Set the font to "Arial", and font size to "24".

  12. Click the B button to make the text bold.

  13. Click the Align Center button.

    • Alternatively, you can right-click on a text object, and use the Properties dialog box to designate font, size, and style. You access more options by using the Properties dialog box.

  14. Click the Border toolbar button to display the Border Toolbar.

  15. With the title text object selected, click the Single-line Border button. A border appears around the title text object.

  16. From the Toolbox, select the Frame object.

  17. Draw a rectangle around the shipping address fields. A frame appears.

  18. Click Save.

  19. Click the Form View button on the Design Toolbar to see the finished form.

    • You will enhance forms with other objects in later lessons. In the last exercise, you learn how to create a new Custom Form.

 Creating a New Form

In the next procedure, you create a custom form for AlphaMovies using the New Form Genie.

You should have already created the AlphaMovies database in the Creating a Database lesson.

To create a new form:

  1. Open the AlphaMovies database.

  2. In the Control Panel, click the Forms tab, and click New. The New Form Genie appears.

  3. First, you select the table or set on which to base the Form.

  4. Select the "Inventory" table, and click Next.

  5. Next you select the form type to create. You can choose from three Form types, described in the following table.

    •  Blank

      A new form without any objects appears in the Form Editor.

    •  Default Form

      A new form with all table/set field objects appears in the Form Editor.

    •  Custom Form

      A new form appears in the Form Editor. This option lets you select the form layout style and field objects.

  6. Select Custom Form and click Next.

  7. In the Layout Style drop-down list box select "Multi-Column" and in Number of Columns select "2". Picture

  8. Now you can select the fields for each column. For "Column 1", select "Title", "Genre", "Language", "Rating", and "Runtime".

  9. For "Column 2", select "TapeID", "Availability", and "Sale Price", and click Next.

  10. You can select a style for the form from a list of predefined styles in the Stylesheet list. Preview the styles and select one you like.

  11. Click Next, and then click Finish. Your custom form appears in the Form Editor.

  12. Click the Save button, and enter the name "InventoryList".

  13. You can click the Form View button to see the finished product, or further edit your form using the Form Editor.

 Summary

In this lesson, you learned how to edit and create a basic Form. You worked with a Default Form, and learned how to move, edit, delete, resize, format, and add form objects. You learned how to use the Design toolbar, the Text, Border, Format, and Arrange toolbars, and the Toolbox floating toolbar, when working with form objects. You learned how to select, move, and align multiple form objects, and how to access object properties using the Properties dialog box. You created a new Custom Form. Using the New Form Genie, you selected fields, specified a layout, and applied a stylesheet.

See Also