Combo Box Description

B

bw

Please bear with me, as I'm not sure how to ask my question.

I have a combo box in a form that has the index, a value, and a description.
For example, one entry might look like this: 1, AP, Accounts Payable.

In the same form, on the same value selected for the combo box, I want to
use another text field to access the Description of the combo box.

For example, in my text field I have tried to access the description in the
combo box with the following for the source code:
=[cboBox].Column(3)
but this is obviously wrong because it gets saved as: =[cboBox].[Column](3)
and gives me the error: #Name?.

For those who understand my question, can you explain what I'm doing wrong?

Thanks,
Bernie
 
R

Rick Brandt

bw said:
Please bear with me, as I'm not sure how to ask my question.

I have a combo box in a form that has the index, a value, and a
description. For example, one entry might look like this: 1, AP,
Accounts Payable.
In the same form, on the same value selected for the combo box, I
want to use another text field to access the Description of the combo
box.
For example, in my text field I have tried to access the description
in the combo box with the following for the source code:
=[cboBox].Column(3)
but this is obviously wrong because it gets saved as:
=[cboBox].[Column](3) and gives me the error: #Name?.

For those who understand my question, can you explain what I'm doing
wrong?

Your expression is fine except that the column numbering starts with zero so
the third column would be .column(2).
 
K

kingston via AccessMonster.com

You can do this with VB or simply concatenate the value and description to
show in the combo box (thereby eliminating the need for another text box).
Assuming the index is the only data that is used, change the combo-box query
to return two columns:

Index, Value & ": " & Description

Please bear with me, as I'm not sure how to ask my question.

I have a combo box in a form that has the index, a value, and a description.
For example, one entry might look like this: 1, AP, Accounts Payable.

In the same form, on the same value selected for the combo box, I want to
use another text field to access the Description of the combo box.

For example, in my text field I have tried to access the description in the
combo box with the following for the source code:
=[cboBox].Column(3)
but this is obviously wrong because it gets saved as: =[cboBox].[Column](3)
and gives me the error: #Name?.

For those who understand my question, can you explain what I'm doing wrong?

Thanks,
Bernie
 
B

bw

Thanks for the reply Rick!

I don't think this is a problem with the column number.
When I enter =[cboBox].Column(1) into the text box source field, it gets
changed to =[cboBox].[Column](1) and gives me the error: #Name? on
execution of the form.

Why?


Rick Brandt said:
bw said:
Please bear with me, as I'm not sure how to ask my question.

I have a combo box in a form that has the index, a value, and a
description. For example, one entry might look like this: 1, AP,
Accounts Payable.
In the same form, on the same value selected for the combo box, I
want to use another text field to access the Description of the combo
box.
For example, in my text field I have tried to access the description
in the combo box with the following for the source code:
=[cboBox].Column(3)
but this is obviously wrong because it gets saved as:
=[cboBox].[Column](3) and gives me the error: #Name?.

For those who understand my question, can you explain what I'm doing
wrong?

Your expression is fine except that the column numbering starts with zero
so the third column would be .column(2).
 
R

Rick Brandt

bw said:
Thanks for the reply Rick!

I don't think this is a problem with the column number.
When I enter =[cboBox].Column(1) into the text box source field, it
gets changed to =[cboBox].[Column](1) and gives me the error: #Name?
on execution of the form.

Why?

When you say "source field" do you mean the Control Source property box?

If you do then =[cboBox].[Column](1) SHOULD return the second column in the
ComboBox providing...

The ComboBox is named cboBox
The TextBox is NOT named cboBox
The ComboBox actually has a second column.

Do you have the ColumnCount property of the ComboBox set to 3?
 
B

bw

Well dummy!

I was using the wrong name for the ComboBox.
I appreciate your help Rick, thanks so much.
Bernie


Rick Brandt said:
bw said:
Thanks for the reply Rick!

I don't think this is a problem with the column number.
When I enter =[cboBox].Column(1) into the text box source field, it
gets changed to =[cboBox].[Column](1) and gives me the error: #Name?
on execution of the form.

Why?

When you say "source field" do you mean the Control Source property box?

If you do then =[cboBox].[Column](1) SHOULD return the second column in
the ComboBox providing...

The ComboBox is named cboBox
The TextBox is NOT named cboBox
The ComboBox actually has a second column.

Do you have the ColumnCount property of the ComboBox set to 3?
 

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