Note:
1. This method can only read the table name (including the system table) and query name in the ACCESS database. Other types such as forms and reports cannot be read.
2. There is only one control list1.
CodeAs follows:
Option explicit
'Project-> reference-> check Microsoft ActiveX Data Objects 2.x Library
Private sub form_load ()
Dim adocn as new ADODB. Connection
Dim rstschema as new ADODB. recordset
Dim SQL as string
Dim I as integer
SQL = "provider = Microsoft. jet. oledb.4.0; Data Source = "& IIF (right (App. path, 1) = "\", app. path, app. path & "\") & "book. MDB; persist Security info = false"
Adocn. Open SQL
Set rstschema = adocn. openschema (adschematables)
Do until rstschema. EOF
If rstschema! Table_type <> "Access Table" and rstschema! Table_type <> "system table" then
List1.additem "name:" & rstschema! Table_name & vbtab & "type:" & rstschema! Table_type & vbcr
I = I + 1
End if
Rstschema. movenext
Loop
Me. Caption = "Total" & I & "items"
Rstschema. Close
Adocn. Close
End sub