Automatically Populate a Listbox

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
 
G

Guest

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:
 

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