Getting value from combo box beside bound column

N

Nigel

I have a combo box with 3 columns, col 1 ia the bound column but I want to
take the values from columns 2 and 3 and place them in seperate fields called
A and B. I know I have seen this done somewhere but cannot find it in the
newsgroup

Thanks
 
O

Ofer

On the ControlSource Property of field A you can write
=Forms![Formname]![ComboName].column(1)

==================================
On the ControlSource Property of field B you can write
=Forms![Formname]![ComboName].column(2)

================================
You wont be able to update this fields.
If you want the ability to update the fields, or you want to bound them to
another field, then on the after update event of the combo write the code

Me.A=me.comboname.column(1)
Me.B=me.comboname.column(2)
 
D

Dirk Goldgar

Nigel said:
I have a combo box with 3 columns, col 1 ia the bound column but I
want to take the values from columns 2 and 3 and place them in
seperate fields called A and B. I know I have seen this done
somewhere but cannot find it in the newsgroup

Thanks

The control's Column property is what you're looking for. I'm sure
you'll find examples in the online help, but for a quick guide:

=cboYourCombo.Column(1)

gets the value from the *second* column in the combo box, while


=cboYourCombo.Column(2)

gets the value from the *third* column. Column(0) is the first column.
 
D

Dirk Goldgar

Ofer said:
On the ControlSource Property of field A you can write
=Forms![Formname]![ComboName].column(1)

Or, if the controls are on the same form, just

=[ComboName].[Column](1)

Access will add the square brackets if you leave them off.
 
Top