If cbxListeTable.ListIndex <> -1 Then With conn.OpenSchema(adSchemaColumns, Array(Empty, Empty, cbxListeTable.Text)) Do Until .EOF lbxChamp.AddItem .Fields("COLUMN_NAME") .MoveNext Loop End With End If
With conn.Open("SELECT `champ1` FROM " & cbxListeTable) Do Until .EOF cbxData.AddItem .Fields("champ1").Value .MoveNext Loop .Close End With
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate moConn As Connection Private Sub CcLstTables_Click() If CcLstTables.ListIndex <> -1 Then CcLstFields.Clear With moConn.OpenSchema(adSchemaColumns, Array(Empty, Empty, CcLstTables.Text)) Do Until .EOF CcLstFields.AddItem .Fields("COLUMN_NAME") .MoveNext Loop .Close End With End If End Sub Private Sub Form_Load() Set moConn = New Connection moConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\a.mdb" CcLstTables.Clear With moConn.OpenSchema(adSchemaTables) Do Until .EOF CcLstTables.AddItem .Fields("TABLE_NAME") .MoveNext Loop .Close End With If CcLstTables.ListCount Then CcLstTables.ListIndex = 0 End If End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) moConn.Close End Sub