How to get the value at the second column of the ComboBox?

  • Follow


I have a ComboBox1 which has two column and the first columns is
bounded. Simply like that:

Supplier-ID   Supplier Name
124556        Microsoft
236541        Apple

"Me.ComboBox1.Value" refers to Supplier-ID because it is bounded
column.
What kind of VBA statement can provide me the value of the second
column which is not bounded (Supplier Name)?
Is It possible?

5
Reply mezzanine1974 9/15/2007 8:23:09 PM

Me.ComboBox1.Column(1)

Column is a zero-based property, so the first column is zero, the second 
column is one, etc.

-- 

        Ken Snell
<MS ACCESS MVP>


"mezzanine1974" <savas_karaduman@yahoo.com> wrote in message 
news:1189887789.286912.160400@r29g2000hsg.googlegroups.com...
>I have a ComboBox1 which has two column and the first columns is
> bounded. Simply like that:
>
> Supplier-ID   Supplier Name
> 124556        Microsoft
> 236541        Apple
>
> "Me.ComboBox1.Value" refers to Supplier-ID because it is bounded
> column.
> What kind of VBA statement can provide me the value of the second
> column which is not bounded (Supplier Name)?
> Is It possible?
> 


9
Reply Ken 9/15/2007 8:37:52 PM


Thank you.. !
it is similar to Me.ComboBox1.ItemData(0). It returns the row values
instead.

-1
Reply mezzanine1974 9/16/2007 7:51:42 AM

ItemData returns the value of the Bound Column's data for a given row -- and 
yes, it's also zero-based.

-- 

        Ken Snell
<MS ACCESS MVP>


"mezzanine1974" <savas_karaduman@yahoo.com> wrote in message 
news:1189929102.056875.310640@y42g2000hsy.googlegroups.com...
> Thank you.. !
> it is similar to Me.ComboBox1.ItemData(0). It returns the row values
> instead.
> 


0
Reply Ken 9/16/2007 3:09:07 PM

Also, you can use the Column property to get the value in any column in any 
row, regardless of which "row" is currently selected in the combobox.

Me.ComboBox.Column(ColumnNumber_ZeroBased, RowNumber_ZeroBased)

Works for listboxes too.

-- 

        Ken Snell
<MS ACCESS MVP>


"Ken Snell (MVP)" <kthsneisllis9@ncoomcastt.renaetl> wrote in message 
news:uB%23w1NH%23HHA.748@TK2MSFTNGP04.phx.gbl...
> ItemData returns the value of the Bound Column's data for a given row --  
> and yes, it's also zero-based.
>
> -- 
>
>        Ken Snell
> <MS ACCESS MVP>
>
>
> "mezzanine1974" <savas_karaduman@yahoo.com> wrote in message 
> news:1189929102.056875.310640@y42g2000hsy.googlegroups.com...
>> Thank you.. !
>> it is similar to Me.ComboBox1.ItemData(0). It returns the row values
>> instead.
>>
>
> 


1
Reply Ken 9/16/2007 5:15:53 PM

i`ll keep in mind. it sounds good.
thanks Ken

-1
Reply mezzanine1974 9/16/2007 8:00:19 PM

5 Replies
31305 Views

(page loaded in 0.056 seconds)


Reply: