Creating a form for data entry
Whether you created a new database, or already had a data source, it must be registered with OpenOffice.org (see above). Once it is registered, linking your form to the data source is simple. Follow these steps to create a new form and link it to a registered data source.
- Create a new document in Writer (File > New > Text Document).
- Design your form, without putting in the actual fields (you can always change it later).
- Show the Form Controls toolbar (View > Toolbars > Form Controls).
- Click the Design Mode On/Off button
to put the document into design mode, if necessary. With design mode off, most of the toolbar buttons are grayed out. If the Design Mode button is also grayed out, click on the Select button to activate it.
- Click the Text Box button
. Click in the document and, holding down the left mouse button, drag the mouse to create a text box for the first form field (for example, Name, if you are linking to the database created above).
- Click the Text Box button
again and drag the mouse to draw another field. Additional fields, of any type, can be added in the same way (click and drag).</li>
So far you have followed the same steps you used before when you created your first form. Now you link your form with the data source you registered.
- Launch the Form Properties dialog box. You can do this by clicking on the Form button
in the Form Controls toolbar or by right-clicking on any of the fields you inserted and selecting Form. The form button is grayed out unless you have one of the form elements selected. As soon as you select a form element in your document, the Form button becomes clickable.
- In the Form Properties dialog box, click on the Data tab.
For each form control in turn, launch the Properties dialog box. Click on the control to select it (so small green boxes appear around it). Then either right-click and select Control or click on the Control button
on the Form Controls toolbar.
- Set Data Source to be the data source you registered.
- Set Content Type to be Table.
- Set Content to be the name of the table you want to access.
- Close the dialog box.
In the Properties dialog box, click on the Data tab. If you set up the form correctly, the Data Field option will contain a list of the different fields in the data source (for example, Name, Address and Telephone). Select the field you want.
Form properties, connecting to a data source.
Repeat for each control in turn until every control that should be has been assigned to a field.
Form control properties, Data tab.
|| If you created a database in OOo Base and your Primary Key field had Auto Value set to Yes, that field does not need to be part of the form. If Auto Value was set to No, you will have to include it and have your users enter an unique value into that field whenever they make a new entry—not something you want.