Estos ejemplos
https://youtu.be/D9t0VOeLVFQ
https://youtu.be/f7ae2oY8Hd4
Así llenas un listbox despues de una consulta SQL realizada a uan base datos Access
Private Sub Label18_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
ColListBox = 7
Dim cn As ADODB.Connection, rs As ADODB.Recordset
UserForm9.ListBox1.ColumnCount = 10
UserForm9.ListBox1 = Clear
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & "data source=" & ThisWorkbook.Path & "\DBPericias.accdb;"
sql = "SELECT Circunscripcion, FechaPericia , HoraPericia, DomicilioPericia, Aceptada, Nom, Secre, NPericia, NExpediente, Caratula, FechaNotifi FROM ConsultaExpte WHERE FechaNotifi >= #" & Format((CDate(primerDia)), "mm/dd/yyyy") & "# AND FechaNotifi <= #" & Format((CDate(ultimoDia)), "mm/dd/yyyy") & "# ORDER BY Circunscripcion ASC, FechaPericia ASC"
Set rs = cn.Execute(sql)
If rs.EOF = True Then
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Exit Sub
Else
UserForm9.ListBox1 = Clear
'Adiciona un item al listbox reservado para la cabecera
UserForm9.ListBox1.AddItem
rs.MoveFirst
Do While Not rs.EOF
UserForm9.ListBox1.AddItem rs.Fields(0).Value
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 1) = Format(rs. Fields(1).Value, "dddd dd/mm/yyyy")
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 2) = Format(CDate((rs. Fields(2). Value)), "hh:mm")
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 3) = rs. Fields(3).Value
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 4) = rs. Fields(4).Value
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 5) = rs. Fields(5).Value
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 6) = rs. Fields(6).Value
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 7) = rs. Fields(7).Value
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 8) = rs. Fields(8).Value
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 9) = rs. Fields(9).Value
rs. MoveNext
Loop
UserForm9.ListBox1.ColumnWidths = "70 pt; 90 pt; 30 pt; 150 pt; 20 pt; 18 pt; 18 pt; 25 pt; 40 pt; 180 pt"
UserForm9. ListBox1. AddItem
UserForm9. ListBox1. AddItem
UserForm9. ListBox1. AddItem
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 3) = "Total de registros"
UserForm9. ListBox1. List(UserForm9. ListBox1.ListCount - 1, 4) = UserForm9. ListBox1. ListCount - 4
'Carga los datos de la cabecera en listbox
For ii = 0 To rs.Fields.Count - 1
UserForm9.ListBox1.List(0, ii) = rs.Fields(ii).Name
Next ii
End If
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
En breve se harán una serie de ejemplos conectando Excel con Access suscribe a https://youtube.com/programarexcel