Using the Wizard to Create a Simple Form

From Apache OpenOffice Wiki
Jump to: navigation, search




Using the Wizard to Create a Simple Form

Making the Form

We will first use the Form Wizard to create a very simple People form for entering data in the People table.

In the main database window (Figure 160), click the Forms icon in the left column. In the Tasks list, click Use Wizard to Create Form to open the Form Wizard (Figure 168). On the left, you can see the possible steps to create a form. Simple forms require only some of these steps, while more complex forms may use all of them. Towards the center, there is a drop-down list titled Tables or queries where you can see that the People table has been chosen.

AOO41GS8 009.png
Figure 168: Form Wizard steps

Step 1: Select fields

  1. Under Tables or queries, select Table: People. Available fields lists the fields for the People table.
  2. Click the field FirstName and then on the right single arrow to move it to the Fields in the form list. Do the same with LastName. Click  Next . We do not put the PeopleID field on the form because it was defined as an AutoValue field, and it will be populated automatically.

Step 2: Set up a subform

This form will not have a subform. Click  Next  and the dialog will jump to Step 5.

Step 5: Arrange controls

Each control in a form consists of two parts: a label and a field. This step in creating the form determines where a control’s label and field are placed in relationship with each other. The four choices from left to right are Columnar – Labels Left, Columnar – Labels on Top, As Data Sheet, and In Blocks – Labels Above. Click the third icon from the left in the Arrangement of the main form section, the As Data Sheet icon, then click  Next .

AOO41GS8 010.png
Figure 169: Form Wizard Step 5 – Detail

Step 6: Set data entry

This step allows limiting what can be done with the form, such as preventing data deletion or viewing existing data. We will leave the defaults in place, but this could be an important step in securing data. Click  Next .

Step 7: Apply styles

You can adjust the appearance of the form at this step with different colors and borders. We will leave the default in place, but you might want to try different settings. Click  Next .

Step 8: Set name

You can give the form any name; there is no need to match the name of the table to which it is connected. We will keep the default name of People and also accept the option Work with the form. Click  Finish  and the form will be ready for data entry. It is a good idea to close the form now and save the main Base document.

Entering Data With the New Form

If you have closed the form, you can open it by clicking on the Forms icon in the main Base window (Figure 160) and then double-clicking on the People icon in the list of Forms.

Data can be entered into the People table by typing into the FirstName and LastName fields. You can navigate from field to field by selecting them with the mouse, using the  Tab ⇆  key or using the buttons of the navigation bar along the bottom of the form's data sheet. The navigation bar shows the current record number, the total number of records and buttons which move the selection to the first record, the previous record, the next record, the last record, and a new record. As you enter data, moving out of a record automatically saves it to the database table. Be sure to exit the last row into which you enter data so that it gets written to the database table.

In later sections, we will add controls to forms that include dropdown lists and there are other methods of automating data input such as buttons to increment numeric values. The basic steps are always same. You navigate from field to field by clicking or with the  Tab ⇆  key and moving to another record automatically saves the entered data. If a record does not meet a requirement placed on the table, for example, not entering data in a field for which input is required, the form will not move to a new record and an error message may appear.

Modifying the Form

The Form Wizard's choices for the size and layout of controls will probably not be ideal. Adjustments can easily be made by opening the form in edit mode. When the form is closed, right click on its icon and select Edit. The form should open ready to be edited, but we will explain how to toggle in and out of Design Mode. If the Form Controls toolbar is not visible, open it with View → Toolbars → Form Controls. The toolbar is shown in Figure 170 with Design Mode on and off and with the button that does the toggling highlighted with red. When Design Mode is off, most of the toolbar's icons are gray.

AOO41GS8 011.png
Figure 170: Form Controls toolbar with Design Mode on and off

With Design Mode on, you can click on the form's data sheet to select it. Eight green handles will appear at the edges of the data sheet. You can click and drag with these to resize it. You can also resize the data sheet's columns by dragging the boundary between them. When resizing the sheet, pay attention to the navigation bar at the bottom so that you do not obscure some controls. You can control more details of the appearance of the data sheet using the Table Control dialog. To access this, right-click on the data sheet and select Control or select it with a left click and then click on the Control icon on the Form Controls toolbar. The Control button is highlighted in blue in Figure 170. In the dialog, you can adjust the size and position, font, background color, border style, and turn off the navigation bar.

Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools