Create Master-Detail Forms in LibreOffice Base

Master-detail forms—often called form-subform relationships—allow you to view and manage data from two related tables simultaneously, such as viewing a customer profile alongside all of their associated orders. This guide provides a straightforward, step-by-step walkthrough for building linked master-detail forms in LibreOffice Base, covering both the Form Wizard method and the manual Form Navigator method.


Prerequisites

Before creating a linked form, ensure your database has a defined relationship: * A Master (Parent) Table containing a Primary Key (e.g., CustomerID in a Customers table). * A Detail (Child) Table containing a Foreign Key (e.g., CustomerID in an Orders table).


Method 1: Using the Form Wizard (Fastest Approach)

The Form Wizard automates the linking process for new forms.

  1. Launch the Wizard: In your LibreOffice Base main window, click on the Forms section in the left pane, then select Use Wizard to Create Form.
  2. Select Master Fields: In the Field selection step, choose your master table from the Tables or queries dropdown and move the desired fields to the right pane. Click Next.
  3. Enable Subform: Check the box labeled Add Subform.
  4. Choose Subform Mode: Select Subform based on manual selection of fields (or Subform based on existing relation if defined in Tools > Relationships) and click Next.
  5. Select Detail Fields: Choose your detail table and move the required fields to the right pane. Click Next.
  6. Link Master and Detail Fields:
    • Under First master field, select the primary key from the master table (e.g., CustomerID).
    • Under First slave field, select the foreign key from the detail table (e.g., CustomerID).
    • Click Next.
  7. Arrange Controls: Choose your preferred layout (e.g., Columnar for the master form and As Data Sheet / Grid for the detail subform).
  8. Save and Finish: Set data entry permissions, apply a style, name the form, and click Finish.

Method 2: Manually Linking a Subform in Design View

If you have an existing form, you can insert and link a detail subform manually.

  1. Open Form in Edit Mode: Right-click your existing master form and choose Edit.
  2. Open Form Navigator: Click the Form Navigator icon on the Form Design toolbar.
  3. Add Subform:
    • In the Form Navigator window, right-click MainForm (or the root form).
    • Select New > Form. Rename this new entry to SubForm.
  4. Configure Subform Data Source:
    • Right-click SubForm in the Form Navigator and select Properties.
    • Go to the Data tab.
    • Set Content type to Table or Query.
    • Set Content to your detail table name.
  5. Establish the Link:
    • In the same Data tab, locate Link master fields and click the ellipsis button (...).
    • Match the parent table’s Primary Key to the child table’s Foreign Key.
    • Click OK and close the Form Properties dialog.
  6. Add Controls to the Subform:
    • Select the SubForm in the Form Navigator to ensure it is active.
    • Add controls to your canvas (such as a Table Control / Grid Control for displaying multiple records).
    • Follow the control wizard to bind specific fields from your detail table.

Testing the Master-Detail Relationship

  1. Toggle off Design Mode (click the Design Mode On/Off icon on the toolbar).
  2. Use the navigation bar at the bottom to browse master records.
  3. The detail subform will instantly update to show only the records corresponding to the active master record.