combo question

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

Guest

I have a bound combo box on my form. I would like to change it so it shows
both columns of the table it gets the list from, but I only want to store the
first column as the data. Can this be sorted too?

Thanks!
 
You can have as many columns as you like in a combo. Only the Bound column
will update. The rest are just for information for the user. You can
capture the value of the unbound colums. For example, if Column 0 (Bound) =
123 and Column 1 (unbound) = "ABC"

?Me.MyCombo will return 123
?Me.MyCombo.Column(0) also returns 123
?Me.MyCombo.Colmun(1) returns "ABC"

As to sorting, there is no Order By for a combo, It inherets the sort order
of the Control Source. If you are using a table or a query, you need to have
the sort order defined there. If you are using a hand entered list, you will
have to enter it in the order you want.
 
Last item first --- the sequence depends on the sequence of the query that's
displaying in the combo box.

To show a second column, change the columns property from 1 to 2 and make
sure to set the column widths accordingly (.5";2.5" will show the first
column in a half inch space and the second column in 2 1/2 inch space,
etc.).

You can either display headings with column labels on the form and not have
the combo box display headings, or you can have the combo box display column
headings. If you let the combo box control do it, the headings will the the
column names from the query. If you just select a column, that'll wind up
to be the table name --- and sometimes those are not pretty. So you can
specify (in the query) ColumnNameToDisplay: ColumnName and the query will
pull column "ColumnName" but give it the name "ColumnNameToDisplay" --- and
that's what'll show in the column names displayed by the combo box control
when the used opens the box.

The bound column property specifies which column is bound, so you will
probably leave that alone since the first column was, and still is, the
bound column.

More than you asked for (I know that) --- but I always appreciated all the
info I could get when I was wrestling with something new.

Bob (@Martureo.Org)
 
Back
Top