可以将以下这段代码放在某个按钮的单击事件中测试一下看看
Dim obj As AccessObject
Dim strTables As String
Dim strQuerys As String
Dim strForms As String
Dim strReports As String
'通过AllTables集合中取每个对象名称合并给变量strTables得到所有表名称
For Each obj In CurrentData.AllTables
strTables = strTables & obj.Name & ";"
Next
MsgBox strTables, vbInformation, "所有表名称"
'所有查询
For Each obj In CurrentData.AllQueries
strQuerys = strQuerys & obj.Name & ";"
Next
MsgBox strQuerys, vbInformation, "所有查询名称"
'所有窗体
For Each obj In CurrentProject.AllForms
strForms = strForms & obj.Name & ";"
Next
MsgBox strForms, vbInformation, "所有窗体名称"
'所有报表
For Each obj In CurrentProject.AllReports
strReports = strReports & obj.Name & ";"
Next
MsgBox strReports, vbInformation, "所有报表名称"