Ian Hulin wrote:
Sorry if this is an FAQ, but if I want to add listbox control on a
form attached to a table, say STUDENTS with a field Students.Tutorial,
and I want it to look up valid values for a primary key on a
TUTORGROUPS table.
The TutorGroups has an Autonumber Integer Primary Key GroupID, and a
some text fields YearNo giving the year no and Suffix.
How do I set up the List Box to use TutorGroups.GroupID in
Students.Tutorial, but also show TutorGroups.YearNo and
TutorGroups.Suffix to allow the user to select an option that means
something to a human being when using the form?
If there's a pointer to a tutorial or wiki page that will help please
let me know. Thanks in advance for your help.
Cheers,
Ian Hulin
Ian,
I don't see a reply to your question yet, so I am responding with my
experience.
I appologize if I mis-understand your question. It sounds like you want
to show more than one table field for each record in a list-box
pull-down. I have been requesting multi-column list boxes for many
months now, maybe years, and they have yet to be implemented. I posted
such a request a long time ago in this forum and I did get a work-around
response from the developers. The work-around is to create a SELECT SQL
statement using the "concat" function to concatenate more than one field
of data for each record. Here is what I have done:
1. Select the subject list box and right-click on it to bring up the
options list.
2. Select the "Controls" option to bring up the list-box properties window.
3. Select the "Data" tab.
4. In the "Data field" box, verify or enter the field name for the table
key.
5. In the "Type of list contents" box, select "Sql".
6. Select the "List content" box and in the pull-down enter something like:
SELECT concat(`f1`,`f2`,...) FROM `database_name`.`table_name`
Where f1, f2, etc. are the field names of the fields you want in the
list-box record.
"database_name" is the name of the database you are using.
"table_name" is the name of the table you are displaying the data from.
Note that the quotes (`) are the left quote, sloped like \, not the
regular single quote (').
There are other properties you may want to play with, but this is the
key to getting several fields in a list-box record.
The down side of this work-around is that the formatting of the fields
in the list box is not in nice neat pretty columns. However, the data
is there to allow a human to make an intelligent selection.
This may be documented somewhere, but I have yet to find it.
You may be able to search the forum for "multi-column list-boxes" or
something like that for my original thread on this problem. I have long
since archived the thread, so I can't easily paste it here.
Good luck and I hope this helps.
Girvin Herr
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]