窗口菜单下面的信息只是表示,系统打开的表、查询、报表、窗体等信息,没有相应的宏能对其操作,可利用如下代码获得
获得打开的窗体
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllForms collection.
For Each obj In dbs.AllForms
If obj.IsLoaded = True Then
' Print name of obj.
Msgbox(obj.Name)
End If
Next obj
获得打开的表
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllTables collection.
For Each obj In dbs.AllTables
If obj.IsLoaded = True Then
' Print name of obj.
Msgbox(obj.Name)
End If
Next obj
获得打开的查询
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllTables collection.
For Each obj In dbs.AllQueries
If obj.IsLoaded = True Then
' Print name of obj.
Msgbox(obj.Name)
End If
Next obj
获得打开的报表
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllTables collection.
For Each obj In dbs.AllReports
If obj.IsLoaded = True Then
' Print name of obj.
Msgbox(obj.Name)
End If
Next obj