Sub getTableName()
Dim RS As ADODB.Recordset
Dim CN As ADODB.Connection
Set CN = New ADODB.Connection
CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Access数据库名.mdb;Persist Security Info=False"
Set RS = CN.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, Empty))
Do Until RS.EOF
If Left(RS!table_name, 4) <> "MSys" Then
List1.AddItem RS!table_name
End If
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
CN.Close
Set CN = Nothing
End Sub
Sub getFieldName()
Dim RS As ADODB.Recordset
Dim CN As ADODB.Connection
Dim FN As ADODB.Field
Set CN = New ADODB.Connection
Set RS = New ADODB.Recordset
CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=access.mdb;Persist Security Info=False"
RS.Open "表名", CN
For Each FN In RS.Fields
List2.AddItem FN.Name
Next
RS.Close
Set RS = Nothing
CN.Close
Set CN = Nothing
End Sub