list box rowsource

  • Thread starter Thread starter Jason
  • Start date Start date
Jason said:
Could I using SQL to extract column value in list box ?

Could you clarify your question? I don't understand what you want to do
when you say "extract column value in list box"... I suspect you are going
to have to tell us what you have, in detail, and what you want, in detail,
rather than ask a "general question".

Larry Linson
Microsoft Office Access MVP
 
Agree with Larry, your question is confusing.

If what you have is a multi-column listbox, and what you want to do is refer
to one of the columns of the selected record in a list box, you can do
something like:

Private Sub lst_YourList_Click

strMsg as string

if me.lst_YourList.ItemsSelected <> 1 then Exit sub

strMsg = me.lst_YourList.column(0) & vbcrlf _
& me.lst_YourList.column(1) & vbcrlf _
& me.lst_YourList.column(2)
msgbox strMsg

End if

The listbox (combo box too) has a column property (zero based) that lets you
refer to the various columns that represent the data in your list. Refering
to a particular column allows you to get information directly from the list
rather than having to requery the data for info regarding the selected item.

HTH
Dale
 
Back
Top