jazminecat
Programmer
I've created a button to list all the items in the database, and managed to make it list the queries. But I don't know how to then make it list the other items.
This works:
Private Sub cmdListAll_Click()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllQueries collection.
For Each obj In dbs.AllQueries
' Print name of obj.
Debug.Print obj.Name
Next obj
But then when I tried this it crashes:
Private Sub cmdListAll_Click()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllQueries collection.
For Each obj In dbs.AllQueries
' Print name of obj.
Debug.Print obj.Name
Next obj
For Each obj In dbs.AllForms
Debug.Print obj.Name
Next obj
Do i need to use a With instead? And if so, how do it string them all together such that I can click this one button and list all of the database objects in the debug window?
Thanks!
This works:
Private Sub cmdListAll_Click()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllQueries collection.
For Each obj In dbs.AllQueries
' Print name of obj.
Debug.Print obj.Name
Next obj
But then when I tried this it crashes:
Private Sub cmdListAll_Click()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentData
' Search for open AccessObject objects in AllQueries collection.
For Each obj In dbs.AllQueries
' Print name of obj.
Debug.Print obj.Name
Next obj
For Each obj In dbs.AllForms
Debug.Print obj.Name
Next obj
Do i need to use a With instead? And if so, how do it string them all together such that I can click this one button and list all of the database objects in the debug window?
Thanks!