4

如何检索 MS-Access 数据库中所有表单的列表?

要检索所有表的列表,我使用它:

For Each TDef In CurrentDb.TableDefs
    If Left(TDef.Name, 4) <> "MSys" And Left(TDef.Name, 7) <> "~TMPCLP" Then
        Debug.Print TDef.Name
    End If
Next

也看到这个问题

但我不能为表格做到这一点。

4

1 回答 1

6

您可以将 AllForms 用于名称列表。这些不是形式的实例,只是名称。

Sub ListForms()
Dim frm As Object
Dim LiveForm As Form

    For Each frm In CurrentProject.AllForms
        Debug.Print frm.Name
        ''To use the form, uncomment
        ''DoCmd.OpenForm frm.Name, acViewDesign
        ''Set LiveForm = Forms(frm.Name)
        ''Do not forget to close when you are done
        ''DoCmd.Close acForm, frm.Name
    Next
End Sub
于 2012-07-20T09:13:42.570 回答