Combo Box BoundColumn property

F

Frederick Chow

Hi all,

I have a queston about the BoundColumn property.

Suppose I set up a combo box with the following two column list:

Column A Column B
1 A
2 B
3 C

My question is, how can I set the BoundColumn property of the list so that
when I select an item, the items in column B, not column A, will be shown on
the combo box? I tried to change the BoundColumn property to 0, 1 or 2, but
the result is still the same.

Best Regards,
Frederick Chow.
 
R

Rob Parker

In the Format tab of the combo-box's properties, set Column Count to 2, and
Column Widths to 0cm;1cm
(or inches, if that's your units). This will effectively hide the first
column. The Bound Column setting in the data tab lets you set which of the
columns from the combo-box's record source is the bound column - it can be
any of them (it defaults to the first column).

Rob
 
G

Graham R Seach

Frederick,

BoundColumn refers to the ordinal position of the column, not its position
in the collection, so BoundColumn=2 will set Column B as the bound column.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
N

Nikos Yannacopoulos

Frederick,

You are not very clear; are you trying to display the contents of column
B to the user, while the comboactually returns the contents of column A?
If that's the case, then you need to set the following properties:
Column Count: 2 (cbo actually has two columns)
Bound Column: 1 (return the contents of the first column)
Column Widths: 0;1 (or 0;whatever>0, so the first column is invisible)

HTH,
Nikos
 
F

Frederick Chow

Hi Nikos.

I tried what you said, but instead the content of Column B will be returned
to the user, instead of Column A as expected. Seemed that hidden columns
won't be returned in any case.

Frederick Chow.
 
F

Frederick Chow

I tried it, but still even though I set BoundColumn = 2, it will still
return Colum A content...

Frederick Chow
 
F

Frederick Chow

Hi Nikos,

Is it possible to display both columns yet return the contents of Column B
to the user?

Frederick Chow
 
N

Nikos Yannacopoulos

Yes. Set the Column Widths property to (say)1;1, i.e. both columns >0,
so they are both visible. If you want the value of column B returned,
then set the Bpund Column property to 2.

At this point maybe I have to clarify something: what I mean by "value
returned" is the value that is saved to the table field the combo is
bound to (if any), the value that is received by another oject (say, a
query or another control on a form) which references the combo etc. I'm
not sure we are on the same page here, when you say "contents returned
to the user'; I suspect what you mean by that is what the user actually
sees on the screen - which has nothing to do with the bound column property.

HTH,
Nikos
 
F

Frederick Chow

Hi Nikos,

Thanks for your clarification here.

Actually what I meant by "return Column B value to user" means to display
the contents of the column B in the combo box.

How can I display the column B in the combo box yet store the column A in
the table? Please advise.

Frederick Chow
Hong Kong.
 
G

Graham R Seach

Frederick,

If you have the first column's width set to >0, then that column will
display in the combo, however, only the column that's set as the BoundColumn
will be saved to the table.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
N

Nikos Yannacopoulos

Frederick,

That is exactly what you get as per my original answer.

Nikos
 

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

Similar Threads


Top