Question : Access VBA - populate ListBox with summary of field

Hi

I have a ComboBox with the field names of a table. Next to the ComboBox is a ListBox.
When the user selects a field name in the ComboBox, I want the ListBox to be populated with one of
each item in that field
What VBA would I use?

Answer : Access VBA - populate ListBox with summary of field

First make sure that the listbox has RowSourceType set to "Table/Query". Then you would write the following code (adapted to your names) in the event procedure of the AfterUpdate event for th combo box:


   Dim sSql As String
   
   sSql = "SELECT " & cbxTableFields & " FROM Table ORDER BY " & cbxTableFields
   Me.lbxTableContent.RowSource = sSql
   Me.lbxTableContent.Requery

HTH

Felix Burkhard
Random Solutions  
 
programming4us programming4us