[Tutorial] Creating a form in Design view

Forum rules
No question in this section please
For any question related to a topic, create a new thread in the relevant section.
Post Reply
decomplexity
Posts: 7
Joined: Sat Jul 24, 2010 6:46 pm

[Tutorial] Creating a form in Design view

Post by decomplexity »

Like others, I have found creating forms in Design view a hit-and-miss affair because of scant documentation and because of major look and feel differences versus Microsoft Access. What follows may prevent others making the same mistakes. Creating a form structure is straightforward, but the snag for me was “how do I bind my form fields to the fields in the data source”, i.e. how do I get my form fields populated with data from the data source.

The following simplistic example is – to keep things short and simple - for a form with just one field.

Select ‘Forms’ from the navigation (LH vertical bar) menu.
Select ‘Create Form in Design View…’ from the tasks area

[Now …bind the form to a particular table…]
Select the Forms Navigator button on the bottom strip menu. This will display:

Forms

in a dialogue box.

Right-click on Forms and select New > Form

The dialogue box will now display

Forms
Form

Right-click on Form (not Forms)
Select Properties
Select the Data tab (if not already selected)
[Content type should read ‘Table’; if not, select Table]
Select the ‘Content’ pull-down menu
Select a table from that menu
Close the dialogue box

[Note that instead of ‘Right-clicking on Form (not Forms)’ above you can instead get the same effect by selecting the Form button on the bottom strip menu]

[Fields from that table can now be bound (linked) to controls (fields) in the form]
Select the Add Field button on the bottom strip menu
Drag a field to where you want it in the form
Close the dialogue box

Select the Design Mode On/Off button on the bottom strip menu
The field you have added should now be seen to display the value of the chosen table field from the first record of the table.

If you don’t like the type of control which was added (which by default is a text box with a label), right click it and either swap it for some other control by using the Control… menu item or make minor adjustments using the other menu items.


If, above, you decided not to use the Add Field button to add a (bound) field, you could instead have created your own field and then bound it as follows:

Select the Text Box button in the LH strip menu (if it is greyed out, click the Design Mode On/Off button on the bottom strip menu near the left)
Click on the form grid and create a box of the right shape by dragging
Right-click on the (‘Text Box 1’) box you ‘drew’ in the form
Select Control…
Select the Data tab (if not already selected)
Select the Data field pull-down menu
Select one of the table data fields to bind to the text box
Close the dialogue box
Select the Design Mode On/Off button on the bottom strip menu
‘Text Box 1’ should now be seen to display the value of the chosen table field from the first record of the table.

Note the major difference to Access:
In Access, selecting a table before creating a form implies that this table is the table whose fields will be bound to the form. In Base, you need to use Forms Navigator (which seems to have no Access equivalent) to enable you to issue New > Form from the Forms context menu and then use the Form context menu to change the Properties of the Form to indicate which table is to be bound to the form. Using Base's Forms Navigator in this was is certainly elegant but hardly intuitive.

There may be simpler ways to do all this: if so perhaps other readers could contribute.
Max
OpenOffice 3.2 on Windows XP SP3
Post Reply