DIY: Create a database form in LibreOffice Base Design View

Learn how to use the LibreOffice Base Design View mode, so you can get more specific and creative with your database forms.

LibreOffice Base allows you to create databases that can be used by any user thanks to its handy forms tool. With the forms generator, you can create multiple, easy to use forms that allow data entry into the databases. There are two ways to create forms with LibreOffice Base: the Forms Wizard or the Design View. I've illustrated how the Forms Wizard works, and now I'll focus on the Design View.

What is the Design View?

The Design View allows you to create forms with much more flexibility. It uses a drag and drop interface where you can create various elements and link those elements to database tables. In the end, you will have the exact form you need to enter the data into your database -- you will no longer depend on the scant templates included with the Forms Wizard.

This customization comes with a price: Using the Design View isn't as easy as the Forms Wizard. It takes time to master using the Design View, but once you do, you'll be able to create amazing forms.

In this tutorial, I explain how to create two elements using the Design View. You can add numerous types of elements, but what can be added will depend on your database; the more complex the database, the more complex your forms can be. Pay close attention to the steps, because if you miss one, you'll wind up pulling out hair more than you will creating forms.

Step one: Open the database to be used for the form

Open LibreOffice Base and, from the opening wizard, select the database you want to use from the Database drop-down. In the Database window (Figure A), click the Create Form In Design View link in the top pane. Once you have the Design View window open, you are ready to begin. Figure A

Click the image to enlarge.

Step two: Add a label element

We are going to create two elements that allow for the entering of a first and a last name. To do this, you must first add a Label element. From the left side-bar, select the Label Field button and then drag and draw the Label field in the working pane (Figure B). You can resize the label using the handles if you like. Figure B

Click the image to enlarge.
Now, right-click the newly created element and select Control. In this new window, you will change the first two fields to First Name (Figure C) and then close the Control Window. Figure C

You can edit quite a lot from this window. At the moment, the only thing necessary is the first two fields.

Step three: Adding a data element

This is where things get a bit tricky. We have to add a data element (in this case a text box) that is associated with a data field from your previously created table. To do this, select the Text Box icon in the left sidebar and then drag and draw the field to the right of the label field (Figure D). Make sure to place this first text box in line with the associated label box (they can be grouped together later). Figure D

Click the image to enlarge.

Step four: Associate the data element with a data field

Now comes the fun part. Right-click the new text box and select Form. In the resulting window, select the necessary table from the Content drop-box (Figure E). This will associate the element with a table, so you can associate the element with a specific field within the table. The available content will depend on the tables you have available in the database to which you are connected. Figure E

Click the image to enlarge.
After you select the content, close out that window, and then right-click the text box again. This time you will select Control, which will open a window (Figure F). This window will open directly into the Data tab, where you need to make your next configuration. Figure F

In the Data Tab, you will see the Data Field drop-down; this is where you associated the element with a field within the table. If you do not set the Data Field, the text box will not add data to the database. And if you don't first select the content in the previous step, you will not be able to select the Data Field. For this particular element, select First Name from the Data Field drop-down and close the window. Now, repeat the previous steps to create a Last Name label and text box.

Step five: Group elements together

I highly recommend grouping elements together so they are easier to move in your form; this is especially true when you have a complicated form. In order to group elements together (say you want to group the First Name label and First Name text box together), do the following:

  1. Select the pointer tool from the left side-bar.
  2. Click and drag to select the two elements to be grouped.
  3. Right-click the selected elements and go to Group | Group.

When you move one of the elements, both will move together.

Step six: Save your form and test

Go to File | Save and give your form a name. To test the form, click the Design Mode On/Off button near the bottom left corner. The form will change modes so you can enter data (Figure G). Type in the data and hit [Enter] to record the data to the database. Figure G

Congratulations! You have created your first form in Design View. Now you can get as creative as you like with your database forms.