1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| ConnectDB
Dim rs As New ADODB.Recordset
Dim rsp As New ADODB.Recordset
Dim i As Integer
Dim x As Integer
Dim num_client As Integer
Set rs = New ADODB.Recordset
Set rsp = New ADODB.Recordset
rs.Open "SELECT n_client, client.nom FROM client", cnx
rs.MoveFirst
List_client.ColumnWidths = "0" & ";" & "50"
i = 0
While Not rs.EOF
List_client.AddItem
List_client.List(i, 0) = rs("n_client")
List_client.List(i, 1) = rs("nom")
rs.MoveNext
i = i + 1
Wend
'jusque-la ca marche
End Sub
Private Sub List_client_Change()
'rsp.MoveFirst
rsp.Open "SELECT n_client, produit From produit WHERE n_client = " + Str(Me.List_client.ColumnCount, Str(1)) + ";", cnx, adOpenStatic, adLockPessimistic
'boucle pour la liste des produits
x = 0
While Not rsp.EOF
lst_produit.AddItem
lst_produit.List(x) = rsp("produit")
rsp.MoveNext
x = x + 1
Wend
End Sub |
Partager