Ask Your Question

Values in a Combo Box [closed]

asked 2017-08-18 00:21:15 +0200

bulldozer gravatar image

updated 2020-08-09 20:02:39 +0200

Alex Kemp gravatar image

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 "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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-08-09 20:02:48.605628

1 Answer

Sort by » oldest newest most voted

answered 2017-08-18 00:48:02 +0200

Ratslinger gravatar image

updated 2017-08-18 00:58:45 +0200

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.

edit flag offensive delete link more


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.

bulldozer gravatar imagebulldozer ( 2017-08-18 08:49:30 +0200 )edit

Question Tools


Asked: 2017-08-18 00:21:15 +0200

Seen: 886 times

Last updated: Aug 18 '17