Automatically Populate a Listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Scenario.

Initially I had a form with 23 combo boxes.
Based on a suggestion, I decided to have one combo box and listbox.
This way I can populate the listbox with values based on my combo box
selection.
I basically want to move the actual selection from my combo box to the
listbox.

My problem is that it works, but it transfers all the values from the combo
box.
What I want is to be able to get that one value from my combo box selection
to automatically populate in the list box. , then continue with another
selection from my combo box. So if I wanted to add 20 values to my listbox
then, all 20 values should be listed in the listbox in one column.

Here is my code sample
 
Code Sample -

Private Sub cboControl_AfterUpdate()
Dim strSQL As String
Dim strWhere As String
strWhere = "WHERE ControlNumber = '" & Me.cboControl & " ' "
strSQL = "SELECT ControlNumber FROM tblSopNumbers" & strWhere
Me.lstControl.RowSource = strSQL
lstControl.Requery

End Sub

te:
 
Back
Top