February 20, 2015

Creating Forms for Easy LibreOffice Database Entry on Linux

The LibreOffice suite of tools includes a very powerful database application ─ one that happens to be incredibly user-friendly. These databases can be managed/edited by any user and data can be entered by anyone using a LibreOffice-generated form. These forms are very simple to create and can be attached to existing databases or you can create both a database and a form in one fell swoop.

There are two ways to create LibreOffice Base forms:

  • Form Wizard

  • Design View.

Design view is a versatile drag and drop form creator that is quite powerful and allows you to add elements and assign those elements to database tables. The Form Wizard is a very simple step-by-step wizard that walks the user through the process of creating a form. Although the Wizard isn’t nearly as powerful as the Design View ─ it will get the job done quickly and doesn’t require any form design experience.

For this entry, I will address the Form Wizard (in a later post, I will walk you through the more challenging Design View). I will assume you already have a database created and ready for data entry. This database can either be created with LibreOffice and reside on the local system or be a remote database of the format:

  • Oracle JDBC

  • Spreadsheet

  • dBASE

  • Text

  • MySQL

  • ODBC.

For purposes of simplicity, we’ll go with a local LibreOffice Base-generated database. I’ve created a very simple database with two tables to be used for this process. Let’s create a data entry form for this database.

Opening the database

The first step is to open LibreOffice Base. When the Database Wizard window appears (Figure 1), select Open an existing database file, click the Open button, navigate to the database to be used, and click Finish

lo base form 1

The next window to appear is the heart and soul of LibreOffice Base. Here (Figure 2) you can manage tables, run queries, create/edit forms, and view reports of the opened database.

lo base form 2

Click the Forms button in the left-side navigation and then double-click Use Wizard to Create Form under Tasks.

When the database opens in the Form Wizard, your first step is to select the fields available to the form. You do not have to select all fields from the database. You can select them all or you can select as few as one.

If your database has more than one table, you can select between the tables in the Tables or queries drop-down (NOTE: You can only select fields from one table in the database at this point). Select the table to be used and then add the fields from the Available fields section to the Fields in the form section (Figure 3).

lo base form 3

Add a sub-form

Once you’ve selected all the necessary fields, click Next. At this point, you can choose to add a sub-form. A sub-form is a form-within-a-form and allows you to add more specific data to the original form. For example, you can include secondary data for employee records (such as work history, raises, etc.) to a form. This is the point at which you can include fields from other tables (besides the initial table selected from the Tables or queries drop-down). If you opt to create a sub-form for your data, the steps include:

  • Selecting the table

  • Adding the fields

  • Joining the fields (such as AuthorID to ID ─ Figure 4).

lo base form 4

Arrange form controls

After all sub-forms are added, click Next to continue on. In the next step, you must arrange the controls of the form. This is just another way of saying how you want to the form to look and feel (where do you want the data entry field to reside against the field label). You can have different layouts for forms and sub-forms (Figure 5).

lo base form 5

Select data entry mode

Click Next when you’ve arranged your controls. The next step is to select the data entry mode (Figure 6). There are two data entry modes:

  • Enter new data only

  • Display all data.

If you want to use the form only as a means to enter new data, select Enter new data only. If, however, you know you’ll want to use the form to enter and view data, select Display all data. If you go for the latter option, you will want to select whether previously entered data can be modified or not. If you want to prevent write access to the previous data, select Do not allow modification of existing data.

lo base form 6

Make your selection and click Next.

Start entering data

At this point you can select a style for your form. This allows you to pick a color and field border (no border, 3D border, or flat). Make your selection and click Next.

The last step is to name your form. In this same window you can select the option, immediately begin working with the form (Figure 7). Select that option and click Finish. At this point, your form will open and you can start entering data.

lo base form 7

After a form is created, and you’ve worked with and closed said form … how do you re-open a form to add more data? Simple:

  1. Open LibreOffice Base.

  2. Open the existing database (in the same manner you did when creating the form).

  3. Double-click the form name under Forms (Figure 8).

  4. Start entering data.

lo base form 8

As a final note, make sure, after you finish working with your forms, that you click File > Save in the LibreOffice Base main window, to ensure you save all of your work.

You can create as many forms as you need with a single database ─ there is no limit to what you can do.

If you’re looking to easily enter data into LibreOffice databases, creating user-friendly forms is just a few steps away. Next time we visit this topic, we’ll walk through the Design View method of form creation.

Click Here!