Filling forms with combo data

I have two tables in a Libreoffice Base database

Table 1: fishing_gears
id_fishing_gear [auto-valued primary key]
fishing_gear [text, unique]

Table 2: samples
id_sample auto-valued primary key]
landing_date [time stamp]
vessel_name [text]
id_fishing_gear [foreign key]

I want to build a form to enter sample data in Table 2, but I don’t want to type the sample.id_fishing_gear itself. I would like to have a combobox with the list of fishing gears registered in Table 1. Once I select one fishing gear in the list, its id_fishing_gear number should be stored in Table 2.

I could create the combobox with the fishing gear list but I couldn’t send fishing_gears.id_fishing_gear to samples.id_fishing_gear.

How can I do this trick? Thanks

Have a look at the list box. List box will show the the text and will save the ID. Code for the box will be

SELECT "fishing_gear", "id_fishing_gear" FROM "fishing_gears"

Default would be the first column will be shown and the second column will be saved.

1 Like