Combo Box - Using Values Other Than Bound Column

R

Robbie Baquiran

Hi All:

Everyone knows the value of a combo box is set to the value of which the
control is bound to. I would like to go a little bit further and use values
that are hidden within it's recordsource.

I know that I can "me.cmbControl.column(x,y)" to return the values in the
various columns within the control, is there an easy way to select the value
of another column of the "Selected Item" in the recordsource? My current
thought is that I would have to itterate on the bound column in order to
find the row of which the record resides ... so that I can call up the value
via .column(x,y). I hope that makes sense.. here's an quick and dirty
example.

[ cmbControl ]
1 | "Dan" | -1
2 | "Tom" | 0
3 | "Bob" | -1
4 | "Joe" | 0

Column one is bound, only column two is visible. If someone selects "Bob",
then me.cmbControl.value = 3, while in order for me to get the value for
column three - I would need to evaluate me.cmbControl.column(2,2).

Is there a better way to find the value of the column three for the selected
item rather than looping around column one untill it matches the value of
cmbControl, figuring out it's row - then fetching the value of column 3?

Any input is appreciated :)

TIA!!
 
R

Rick Brandt

Robbie said:
Hi All:

Everyone knows the value of a combo box is set to the value of which
the control is bound to. I would like to go a little bit further and
use values that are hidden within it's recordsource.

I know that I can "me.cmbControl.column(x,y)" to return the values in
the various columns within the control, is there an easy way to
select the value of another column of the "Selected Item" in the
recordsource? My current thought is that I would have to itterate on
the bound column in order to find the row of which the record resides
... so that I can call up the value via .column(x,y). I hope that
makes sense.. here's an quick and dirty example.

[ cmbControl ]
1 | "Dan" | -1
2 | "Tom" | 0
3 | "Bob" | -1
4 | "Joe" | 0

Column one is bound, only column two is visible. If someone selects
"Bob", then me.cmbControl.value = 3, while in order for me to get the
value for column three - I would need to evaluate
me.cmbControl.column(2,2).
Is there a better way to find the value of the column three for the
selected item rather than looping around column one untill it matches
the value of cmbControl, figuring out it's row - then fetching the
value of column 3?
Any input is appreciated :)

TIA!!

(forehead slapper)
Just leave the row out of the expression.

me.cmbControl.column(2)
 
R

Robbie Baquiran

DOH!!! Thanks Rick - and I spent the whole ten minutes to script out that
iteration routine .. bleh ><


Rick Brandt said:
Robbie said:
Hi All:

Everyone knows the value of a combo box is set to the value of which
the control is bound to. I would like to go a little bit further and
use values that are hidden within it's recordsource.

I know that I can "me.cmbControl.column(x,y)" to return the values in
the various columns within the control, is there an easy way to
select the value of another column of the "Selected Item" in the
recordsource? My current thought is that I would have to itterate on
the bound column in order to find the row of which the record resides
... so that I can call up the value via .column(x,y). I hope that
makes sense.. here's an quick and dirty example.

[ cmbControl ]
1 | "Dan" | -1
2 | "Tom" | 0
3 | "Bob" | -1
4 | "Joe" | 0

Column one is bound, only column two is visible. If someone selects
"Bob", then me.cmbControl.value = 3, while in order for me to get the
value for column three - I would need to evaluate
me.cmbControl.column(2,2).
Is there a better way to find the value of the column three for the
selected item rather than looping around column one untill it matches
the value of cmbControl, figuring out it's row - then fetching the
value of column 3?
Any input is appreciated :)

TIA!!

(forehead slapper)
Just leave the row out of the expression.

me.cmbControl.column(2)
 

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