Retrieve list of forms in an Access database
ms-access, ms-access-2007
Solution
You can use AllForms for a list of names. These are not instances of forms, just names.
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
Problem
How can I retrieve a list of all forms in a MS-Access database? To retrieve a list of all tables I use this: ``` 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 ``` Also see this issue. But I can't do this for forms.