List box to contain fields from another table within the db

Version: 7.5.0.3 (X86_64) / LibreOffice Community
Build ID: c21113d003cd3efa8c53188764377a8272d9d6de
CPU threads: 4; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: CL threaded

How do I make the selections displayed in a form list box to be the contents of another table within the db, ensuring the only selections possible are those that already exist in that second table.

“table1” is the source of the form. It contains a field “person_ID”, which should be filled with the value from another table.
“tbl_person” is the second table. It contains “ID” (as primary key) and “name”.

Open the form for editing. Switch field for “person_ID” to a listbox. Go to tab for “Data”. Choose SQL. You could create a query here. Choose “tbl_person”. First field should be “name”, second field should be “ID”. Let the query be ordered by “name”. Close the query, close the listbox-properties and save the form. Close the form and reopen it for input data. You could choose all rows of “tbl_person” by the “name”. “ID” will be saved.

1 Like

Thank you very much. I scoured the Base User Guide, several online tutorials and many questions and answers here but nowhere was there such a complete, concise and logical explanation of how it’s done as yours.

I have described this also in German Base Handbuch, which is source of the Base Guide. Have a look here:
https://books.libreoffice.org/en/BG73/BG7301-IntroductionToBase.html#toc33
Move a little bit up and there will be a step by step description for choosing “Sport” in a table control by a list box.