Combo Box Columns

G

Guest

I have a simple combo box that is taking its row source from a newly created
table that has only two colums - the key (just a list of continuous numbers)
and a list of surnames.

No matter what settings I try I can only get the combo box to display the
numbers from the key, how do I get it to just show the surnames from column 2
of the table?

Can anyone help?
 
G

Guest

I would like to expand on Mr/s. Frog's question. I also have cbo's with
multiple columns. The column counts and widths are as suggested by Mr.
Steele. When I drop down the list box to display the list of values in the
domain, all the columns in the cbo are displayed. However, after a value is
selected, only the first column is displayed. How do I display all columns
after a value is chosen by the user? Thank you.
 
T

tina

you can't, within the combo box control itself. only the first non-zero
width column will be displayed in the control after a selection is made from
the droplist. but you *can* display the values from the other columns. just
add an unbound textbox to the form, for each column value you want to
display. set each textbox's ControlSource property to reference a specific
column, as

=cboName.Column(n)

replace cboName with the name of the combo box control, of course. replace
the "n" value, within the parentheses, with the index value of the column
you want to display. the combo box column index is zero-based, so the first
column (counting from left to right) is 0, the second column is 1, the third
column is 2, etc.

hth
 
D

Douglas J. Steele

You can't, at least, you can't in the combo box.

You can, however, add text boxes to your form that you can populate from the
combo box in its AfterUpdate event.

If, for example, the 2nd and 3rd columns were something you wanted to put
into text boxes, you'd put code like:

Me.txtField1 = Me.MyComboBox.Column(1)
Me.txtField2 = Me.MyComboBox.Column(2)

in that event. Note that the Column collection starts counting at 0.
 
G

Guest

Thank you, Tina. I tried your suggestion; I specified
"cboSelTransect.Column(2)" for the Control Source. When I bring up the form -
and even after I select a value from the domain of cboSelTransect - the value
in the text box is "#Name?"
- David
 
T

tina

okay, good job. i didn't see this post until i'd already responded to the
previous one. :)
 
G

Guest

This brings me to the next question. How do I reference the different columns
in a query? I have a report, whose query wants to contain the clause: HAVING
tabname.colname = [forms]![formname].[cboBoxname].[Column(1)]. Referencing
the column (at least using this syntax) is not recognized. Is there a way to
reference the individual columns in a combo box in a query? If not, I could,
as a workaround, concatenate the columns to form the key of the combo box and
do likewise to the columns from the query in the HAVING clause. Thanks.
 
T

tina

try

[forms]![formname].[cboBoxname].[Column](1)

hth


David Berg said:
This brings me to the next question. How do I reference the different columns
in a query? I have a report, whose query wants to contain the clause: HAVING
tabname.colname = [forms]![formname].[cboBoxname].[Column(1)]. Referencing
the column (at least using this syntax) is not recognized. Is there a way to
reference the individual columns in a combo box in a query? If not, I could,
as a workaround, concatenate the columns to form the key of the combo box and
do likewise to the columns from the query in the HAVING clause. Thanks.

tina said:
okay, good job. i didn't see this post until i'd already responded to the
previous one. :)


made
from columns.
just the
first the
third values in
the surnames
from
 
G

Guest

I tried that, too. But the SQL fails because it thinks
'[forms]![formname].[cboBoxname].[Column]' is a function, whose parameter is
(1), and, of course, there is no such function. I successfully worked around
the problem using the concatenation operation described below. Thanks again,
Tina, for your assistance.
- David

tina said:
try

[forms]![formname].[cboBoxname].[Column](1)

hth


David Berg said:
This brings me to the next question. How do I reference the different columns
in a query? I have a report, whose query wants to contain the clause: HAVING
tabname.colname = [forms]![formname].[cboBoxname].[Column(1)]. Referencing
the column (at least using this syntax) is not recognized. Is there a way to
reference the individual columns in a combo box in a query? If not, I could,
as a workaround, concatenate the columns to form the key of the combo box and
do likewise to the columns from the query in the HAVING clause. Thanks.

tina said:
okay, good job. i didn't see this post until i'd already responded to the
previous one. :)


OK. I got it. I forgot the '='.
Thanks to both you and Mr. Steele.
- David

:

you can't, within the combo box control itself. only the first non-zero
width column will be displayed in the control after a selection is made
from
the droplist. but you *can* display the values from the other columns.
just
add an unbound textbox to the form, for each column value you want to
display. set each textbox's ControlSource property to reference a
specific
column, as

=cboName.Column(n)

replace cboName with the name of the combo box control, of course.
replace
the "n" value, within the parentheses, with the index value of the
column
you want to display. the combo box column index is zero-based, so the
first
column (counting from left to right) is 0, the second column is 1, the
third
column is 2, etc.

hth


I would like to expand on Mr/s. Frog's question. I also have cbo's
with
multiple columns. The column counts and widths are as suggested by Mr.
Steele. When I drop down the list box to display the list of values in
the
domain, all the columns in the cbo are displayed. However, after a
value
is
selected, only the first column is displayed. How do I display all
columns
after a value is chosen by the user? Thank you.

:

Column Count: 2
Column Widths: 0";1"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have a simple combo box that is taking its row source from a
newly
created
table that has only two colums - the key (just a list of
continuous
numbers)
and a list of surnames.

No matter what settings I try I can only get the combo box to
display
the
numbers from the key, how do I get it to just show the surnames
from
column 2
of the table?

Can anyone help?
 
T

tina

you're welcome, David, glad you figured out a way to make it work for you.
:)


David Berg said:
I tried that, too. But the SQL fails because it thinks
'[forms]![formname].[cboBoxname].[Column]' is a function, whose parameter is
(1), and, of course, there is no such function. I successfully worked around
the problem using the concatenation operation described below. Thanks again,
Tina, for your assistance.
- David

tina said:
try

[forms]![formname].[cboBoxname].[Column](1)

hth


David Berg said:
This brings me to the next question. How do I reference the different columns
in a query? I have a report, whose query wants to contain the clause: HAVING
tabname.colname = [forms]![formname].[cboBoxname].[Column(1)]. Referencing
the column (at least using this syntax) is not recognized. Is there a
way
to
reference the individual columns in a combo box in a query? If not, I could,
as a workaround, concatenate the columns to form the key of the combo
box
and
do likewise to the columns from the query in the HAVING clause. Thanks.

:

okay, good job. i didn't see this post until i'd already responded
to
the
previous one. :)


OK. I got it. I forgot the '='.
Thanks to both you and Mr. Steele.
- David

:

you can't, within the combo box control itself. only the first non-zero
width column will be displayed in the control after a selection
is
made
from
the droplist. but you *can* display the values from the other columns.
just
add an unbound textbox to the form, for each column value you
want
to
display. set each textbox's ControlSource property to reference a
specific
column, as

=cboName.Column(n)

replace cboName with the name of the combo box control, of course.
replace
the "n" value, within the parentheses, with the index value of the
column
you want to display. the combo box column index is zero-based,
so
the
first
column (counting from left to right) is 0, the second column is
1,
the
third
column is 2, etc.

hth


I would like to expand on Mr/s. Frog's question. I also have cbo's
with
multiple columns. The column counts and widths are as
suggested by
Mr.
Steele. When I drop down the list box to display the list of values in
the
domain, all the columns in the cbo are displayed. However, after a
value
is
selected, only the first column is displayed. How do I display all
columns
after a value is chosen by the user? Thank you.

:

Column Count: 2
Column Widths: 0";1"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I have a simple combo box that is taking its row source from a
newly
created
table that has only two colums - the key (just a list of
continuous
numbers)
and a list of surnames.

No matter what settings I try I can only get the combo box to
display
the
numbers from the key, how do I get it to just show the surnames
from
column 2
of the table?

Can anyone help?
 
L

Lena

THANK YOU, THANK YOU, THANK YOU. I have been all over this forum trying to
get this thing right. Each time I set up a column(n), my system would crash.
I began doing one at a time and saving as I went along and it works
PERFECTLY. Thank you so much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top