Option Explicit
Dim BDD As DAO.Database
Dim RS As Recordset
Dim BDDPath As String
Dim SQLQuery As String
Dim ListeResultats() As Variant
Private Sub CMDBRechercher_Click()
Dim a, m, n, z As Integer
BDDPath = ThisWorkbook.Path & "\BDDJuridique.mdb"
Set BDD = OpenDatabase(BDDPath, False, False, ";pwd=98000256")
SQLQuery = "SELECT * FROM Juridique WHERE " & CBCritere1 & "= " & "'" & TBCritere1 & "'"
Set RS = BDD.OpenRecordset(SQLQuery)
RS.MoveLast
m = RS.RecordCount
RS.MoveFirst
ListeResultats = RS.GetRows(m)
With ListBoxResultats
.List = ListeResultats
.ColumnWidths = "50;50;50;50;50;50;50,50;50;50;50;50;50;50,50;50;50;50;50;50;50"
End With
End With