Values in a Combo Box

Hi. I’m new to LibreOffice Base. I started a project where I have articles and authors in a database. I created a form to insert them. Both have a separate table. In the form for new articles I have a combo box which lists the authors. It works with the first SQL-statement, but not with the second or third:

SELECT DISTINCT "AuthorID" FROM "T_Authors"
SELECT DISTINCT "lastname", "AuthorID" FROM "T_Authors"
SELECT DISTINCT "lastname" || ', ' || "firstname" AS "Name", "AuthorID" FROM "T_Authors"
SELECT DISTINCT "lastname" || ', ' || "firstname" AS "Name", "AuthorID" AS "F_AuthorID" FROM "T_Authors"

Of courye I want the box to list the author by name, not by value. But as soon as I add a value other than the author id it fails. In that case the combo box mostly jumps back to “0” and alway writes the value 0. How to tell it whick is the value to display in the combo box and which is the one to store?

If you are looking to display one value & save another you need to use a list box. In a listbox, the value displayed is the first one in the selection. The value stored is the one indicated by the Bound field. this bound field is relative to 0, so in your examples the concatenated field (Name) will be displayed and if the AuthorID is what is to be saved, then Bound field should be set to 1.

With a combo box, the displayed value is the value saved. The advantage of the combo box is selecting from the list or entering a value not in the list.

HI, thanks. That was very helpful. It did not work the first time. I had to change the bound filed two time before it worked but now it works fine. Thank you.