[Solved] listbox help with defaults?

Creating and using forms
Post Reply
JoeFriday
Posts: 10
Joined: Sun Aug 25, 2013 7:12 am

[Solved] listbox help with defaults?

Post by JoeFriday »

I am very much a noob at this base stuff. have begun creating my first project, and am having a frustrating experience.

I have tables. Index, List1, list2, list3.

The index is the table I want to hold all my data. and the lists are tables, with lists in them to populate drop down boxes on my form.

I have begun creating a form, that updates the index.

I have a text box for name, and one for notes. both working fine.
I have 3 listbox drop down, each populates itself from a different "list table"

The problem I am having is the list boxes, seem to default to either whatever was in them last, or option1.

This is probably a very long winded way of asking......
how can I make those list boxes, show the value that is in the INDEX table, unless I choose to change it, then it would save that change.

Thanks in advance :)
Last edited by RoryOF on Sun Aug 25, 2013 1:47 pm, edited 2 times in total.
Reason: Added Green tick.
OpenOffice 3.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31349
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: listbox help with defaults?

Post by Villeroy »

Properties of your list box, tab "Data"

Variant #1:
Linked Field: XID [the foreign key where the other table's primary key gets stored]
Source type: SQL
Source: SELECT "Field A" AS "Visible", "Primary Key" AS "Bound" FROM "Your List" ORDER BY "Visible".
Bound Field: 1 [the other one would be 0]

Variant #2
Linked Field: XID [the foreign key where the other table's primary key gets stored]
Source type: Query
Source: MyListBox [name of the query SELECT "Field A" AS "Visible", "Primary Key" AS "Bound" FROM "Your List" ORDER BY "Visible"]
Bound Field: 1 [the other one would be 0]
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JoeFriday
Posts: 10
Joined: Sun Aug 25, 2013 7:12 am

Re: listbox help with defaults?

Post by JoeFriday »

while I work through trying to figure out the above..

its worse than i thought. regardless of which record I am on, when I click a name in the drop down list, and save the record. it is always saving to record number 1
OpenOffice 3.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31349
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: listbox help with defaults?

Post by Villeroy »

Nobody can help you without technical information about your database. Build your database with proper primary and foreign keys and let your list boxes edit the foreign keys. This is what 99.9% of all list boxes are supposed to do and it is always the same cooking recipe which leads to a proper list box on top of a proper one-to-many relation.
[Example] Relations reflected by list boxes in forms with lots of list boxes all doing the same thing, composed in the exact same manner on top of a set of relations (integer foreign keys pointing to integer primary keys).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JoeFriday
Posts: 10
Joined: Sun Aug 25, 2013 7:12 am

Re: listbox help with defaults?

Post by JoeFriday »

starting over from scratch seemed to fix it :) sorry for the disruption.
OpenOffice 3.1 on Windows 7
Post Reply