Access 2007 combo box

M

Mike

I want to be able to determine which column is clicked on a combo box
displaying multiple columns so that I can select that value from that column
instead of the bound value set up in the properties section. How do I do
that?
 
D

Damon Heron

If you want the value of a particular column, use the click event of the
combo, and assign it to whatever, like:
myresult = me.mycombobox.column(x)
where x is the position of the column starting with 0.

Damon
 
M

Mike

Damon, do I use the code like that [myresult = me.mycombobox.column(x) ] with
(x)? User may select either column 1, 2 or 3. I just want to save that
selection, whatever it is. If I have to put 1, 2 or 3 for "x" then that
defeats the selection process. User may select 1 of 3 values by clicking on a
particular column. Does that set the "x" at that point. Should code look
like: myresult = me.mycombobox.column() ?
 
D

Damon Heron

I think you misunderstand how a combobox works. You can't select an
individual column. You select the row that contains the columns. I thought
you wanted to know the value of a column in a particular row. But Access
can't read the user's mind. Who knows which column the user was clicking
on? I think you need to re-think your design. Maybe explain further what
you are after and there may be other options.
As an aside, when a user selects a row in a combo box, the columns (if there
are more than one) are also selected. To determine the value of a
particular column, you use my code snippet, and specify which column you
want, using 0, 1, 2, etc for the x.

Damon

Mike said:
Damon, do I use the code like that [myresult = me.mycombobox.column(x) ]
with
(x)? User may select either column 1, 2 or 3. I just want to save that
selection, whatever it is. If I have to put 1, 2 or 3 for "x" then that
defeats the selection process. User may select 1 of 3 values by clicking
on a
particular column. Does that set the "x" at that point. Should code look
like: myresult = me.mycombobox.column() ?


Mike said:
I want to be able to determine which column is clicked on a combo box
displaying multiple columns so that I can select that value from that
column
instead of the bound value set up in the properties section. How do I do
that?
 
M

Mike

You are right. I didn't understand exactly how combobox works. Previously, I
have only used single column entries. I will redesign my form to ask user
which column he wants. Thanks.

Damon Heron said:
I think you misunderstand how a combobox works. You can't select an
individual column. You select the row that contains the columns. I thought
you wanted to know the value of a column in a particular row. But Access
can't read the user's mind. Who knows which column the user was clicking
on? I think you need to re-think your design. Maybe explain further what
you are after and there may be other options.
As an aside, when a user selects a row in a combo box, the columns (if there
are more than one) are also selected. To determine the value of a
particular column, you use my code snippet, and specify which column you
want, using 0, 1, 2, etc for the x.

Damon

Mike said:
Damon, do I use the code like that [myresult = me.mycombobox.column(x) ]
with
(x)? User may select either column 1, 2 or 3. I just want to save that
selection, whatever it is. If I have to put 1, 2 or 3 for "x" then that
defeats the selection process. User may select 1 of 3 values by clicking
on a
particular column. Does that set the "x" at that point. Should code look
like: myresult = me.mycombobox.column() ?


Mike said:
I want to be able to determine which column is clicked on a combo box
displaying multiple columns so that I can select that value from that
column
instead of the bound value set up in the properties section. How do I do
that?
 

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