Page 1 of 1

[Solved] listbox help with defaults?

Posted: Sun Aug 25, 2013 7:25 am
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 :)

Re: listbox help with defaults?

Posted: Sun Aug 25, 2013 10:58 am
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]

Re: listbox help with defaults?

Posted: Sun Aug 25, 2013 11:10 am
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

Re: listbox help with defaults?

Posted: Sun Aug 25, 2013 11:20 am
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).

Re: listbox help with defaults?

Posted: Sun Aug 25, 2013 1:42 pm
by JoeFriday
starting over from scratch seemed to fix it :) sorry for the disruption.