I'm trying to add table column data as listbox items, i tried to add table column names as list box items. But how do i add table column data as listbox items. I have a table
Column1
A
B
C
D
E
I tried adding table column names as listbox items, vba
Sub item1()
On Error Resume Next
Dim i As Integer 'Index for loop
With Me.lstbox
.RowSourceType = "Value List" 'Set rowsource type
.RowSource = "" 'Clean combo contents
End With
For i = 1 To CurrentDb.TableDefs("table1").Fields.Count
Me.lstbox.AddItem (CurrentDb.TableDefs("table1").Fields(i -1).Name)
Next i
End with
End sub
How do i have A,B,C,D,E as listbox items.