Frequently asked questions - Base

From The Document Foundation Wiki
< Faq‎ | Base
Jump to: navigation, search

How do I use a listbox in a form?

When filling a table field, it may be more convenient to select entry values from a list box rather than typing in values each time.

  • Required tables:

The database should contain at least two tables: the table that holds data, and a second which is the source of the values that will be used in the list box.

  • The form:
    • Open the form in design mode
    • Select the form control that you wish to fill from a list box: the green corners will appear
    • right click: select "Replace with" and choose "List Box"
  • Filling the list box
    • Open the control
    • On the data tab of the properties sheet
      • Select "SQL" for "type of list contents"
      • In the "list contents" field click the button with three dots and build the query to select from the source table.

The field values to display should be in the first column, the ID of the field in the second column

  • Result

In the main table, for each value chosen from the list box, the corresponding ID from the source table will be entered.