In my project, I have a query that fetches the right values, but when I use the table as the rowsource
for a listbox, it doesn't display the same values.
For my example, I am using Star Wars Scenes.
There are two Tables: Characters
, Scenes
and one Form.
The Characters
Table has these columns: ID
and Title
. It is filled with names of Star Wars characters.
The Scenes
Table has these columns: ID
, Title
and Appearances
. Appearances
is a multi-select column and performs a lookup against the Characters.ID field. Here is the lookup string for that column:
SELECT Characters.[Title], Characters.ID FROM Characters ORDER BY Characters.[Title];
Here is where the trickiness happens. Although the Appearances
field is bound to Characters.ID
, it displays Characters.Title Instead of displaying the IDs in the table, I want it to display the names for human readability. Notice how the sql string is set to
Characters.IDas the *second* column - *AND* - it is that column which is bound. This keeps the table bound to the
IDcolumn properly, but since the *first* column is the
Titlethen it is the
Title` that displays in the table when humans look at it.
Lookup Column for Scenes.Appearances
When I view the Scenes
table, I see the names of the characters in the Appearances column, separated with commas - perfect!
Scenes Table Displaying Titles Instead of IDs
However, when I use this table as the rowsource
for a listbox, I want the same effect but the listbox only displays the ID
instead (I assume it is because that is the bound column).
How do I make the listbox display like the Table does? I am hoping there is a simple trick to get the listbox to display the same way as the query does. The table displays the names from the non-bound column, but the listbox does not, even though the listbox is set to display the same table. Maybe there's a better way to go about this? Or is this a bug?
Listbox Displaying Scenes Table
I have been looking at this question, which is similar, but can't figure this out.
I think I've described everything well enough, but here is my sample database; in my google drive. Here is a good explanation of the multi-select field in the Scenes
table.