Page thru Listbox

  • Thread starter Thread starter john
  • Start date Start date
J

john

In building an SQL satement from a List box, What other code do I need to
read thru each row of the list box and retrive its value?
How do I use "Set" or "Dim" for A_Row, and A_ListBox to work in my For Each
statement?


Dim SomeVariable, FromSQL

For Each A_Row In A_ListBox
SomeVariable = ListBoxName.Value
FromSQL = FromSQL & "INNER JOIN ([" & SomeVariable & ".mdb]." & SomeVariable
& ""
Next

John
 
Hi,
Here is one way:
Dim i As Integer

For i = 0 To Me.Combo11.ListCount - 1
MsgBox Me.Combo11.Column(0, i)
Next

The first argument is the column, so if you need to get at a column other than the first one (column 0)
just change the number appropriately

--
HTH
Dan Artuso, Access MVP


john said:
Correction: it is a ComboBox, but same question.

John
john said:
In building an SQL satement from a List box, What other code do I need to
read thru each row of the list box and retrive its value?
How do I use "Set" or "Dim" for A_Row, and A_ListBox to work in my For
Each statement?


Dim SomeVariable, FromSQL

For Each A_Row In A_ListBox
SomeVariable = ListBoxName.Value
FromSQL = FromSQL & "INNER JOIN ([" & SomeVariable & ".mdb]." &
SomeVariable & ""
Next

John
 
Thanks, worked great
John
Dan Artuso said:
Hi,
Here is one way:
Dim i As Integer

For i = 0 To Me.Combo11.ListCount - 1
MsgBox Me.Combo11.Column(0, i)
Next

The first argument is the column, so if you need to get at a column other
than the first one (column 0)
just change the number appropriately

--
HTH
Dan Artuso, Access MVP


john said:
Correction: it is a ComboBox, but same question.

John
john said:
In building an SQL satement from a List box, What other code do I need
to
read thru each row of the list box and retrive its value?
How do I use "Set" or "Dim" for A_Row, and A_ListBox to work in my For
Each statement?


Dim SomeVariable, FromSQL

For Each A_Row In A_ListBox
SomeVariable = ListBoxName.Value
FromSQL = FromSQL & "INNER JOIN ([" & SomeVariable & ".mdb]." &
SomeVariable & ""
Next

John
 
Back
Top