combo box bound

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to get my combo box to show all 3 fields in the dropdonwbut bound
to the 3rd field. It keeps showing the 1st field after the selection how do
I get it to show the 3rd field?
I have colum count set to 3 and bound set to 3
 
The column count is then number or columns in the box's row source. The
bound column is the data column that will be returned to any code that asks
the combo box for its value like Me.Combo8.Value will return the value of the
bound column. The column widths is how wide you want each column to be like
0";0.5";3.2";1". Each ";" will be a column’s width. If you make a column's
width equal to 0" then it will not show in the combo box's drop down but will
still be in the list. So this way you can make the Primary key(ID field)
your bound column and by setting its width to 0" you hide it from the user.

Hope this helps.
Good Luck!
 
My three fields are length width and description
I would like them to appear in this order, but have description as the bound
column
that is why I set the bound column to 3.
After the select I want descr to show on the form, and will use length and
width from code.
But when I do this length shows up on my form.
 
Hmm.. im not sure you can do that. When you select something in the dropdown
it puts the value of the first column in the box even if you set your bound
column to something else. The bound column is just for code not what shows
on the screen after you make a selection. The only way you will get
description to show after you make a selection is to make description the
first column in your row source or after you select then have code to fill in
an unbound textbox with the value like text2.value = combo8.value
Sorry i couldn't be more helpful.
Good Luck!
 
Thank you for the help, at least now I won't spend any more time trying to
get this to work. I will have to make descr the first column.
 
I am trying to get my combo box to show all 3 fields in the dropdonwbut bound
to the 3rd field. It keeps showing the 1st field after the selection how do
I get it to show the 3rd field?
I have colum count set to 3 and bound set to 3

A Combo only shows one field when it's not dropped down - that's just
the way they're designed.

Two getarounds if you want to see multiple fields:

- put two unbound Textboxes on the form with control source

=comboboxname.Column(1)
=comboboxname.Column(2)

to show the second and third (it's zero based) column

- Or, base the combo on a Query in which the first nonzero width field
is an expression concatenating the fields you want to see:

SELECT PersonID, [FirstName] & (" " + [MiddleName]) & " " & [LastName]
AS FullName FROM people ORDER BY LastName, FirstName, MiddleName;

ColumnWidths 0;1.5 will store the PersonID and display the full name.

John W. Vinson[MVP]
 
Thank you for the info. I cannot do what I originally intended. My bound
column is long so when the drop down shows I wanted my 2 short columns first
and the long one second, problem is the long one is my bound column.
Guess I could use another text box box to capture the third column, instead
of
capturing it with the combo box.

John Vinson said:
I am trying to get my combo box to show all 3 fields in the dropdonwbut bound
to the 3rd field. It keeps showing the 1st field after the selection how do
I get it to show the 3rd field?
I have colum count set to 3 and bound set to 3

A Combo only shows one field when it's not dropped down - that's just
the way they're designed.

Two getarounds if you want to see multiple fields:

- put two unbound Textboxes on the form with control source

=comboboxname.Column(1)
=comboboxname.Column(2)

to show the second and third (it's zero based) column

- Or, base the combo on a Query in which the first nonzero width field
is an expression concatenating the fields you want to see:

SELECT PersonID, [FirstName] & (" " + [MiddleName]) & " " & [LastName]
AS FullName FROM people ORDER BY LastName, FirstName, MiddleName;

ColumnWidths 0;1.5 will store the PersonID and display the full name.

John W. Vinson[MVP]
 
Thank you for the info. I cannot do what I originally intended. My bound
column is long so when the drop down shows I wanted my 2 short columns first
and the long one second, problem is the long one is my bound column.
Guess I could use another text box box to capture the third column, instead
of
capturing it with the combo box.

Note that the combo's RowSource can be a query, and the fields can be
in any order you wish in that query; and the bound column can be any
of them. The first nonzero width column will be visible when the combo
is not dropped down; and that can be any field in the table.

John W. Vinson[MVP]
 
Back
Top