Getting All Form Objects In Access VBA
In Access all forms are contained as objects in the AllForms collection, which is part of the Application.CurrentProject object. To iterate through them and print them off just load them one by one into a temporary object and use the Name property of the form object to print off its name.
Sub AllForms()
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
' Print name of obj.
Debug.Print obj.Name
Next obj
End Sub
If you want to get a list of all of the active form objects (ie. those forms that are currently open) then use the IsLoaded property for each object.
Sub AllForms()
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.
Debug.Print obj.Name
End If
Next obj
End Sub
Debt help www.thedebtpeople.co.uk
Debt Collection Agencies
Debt Recovery Online
Xpat Rentals in Venice
Recent Comments