Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you display objects in a collection

Status
Not open for further replies.

PatSalmon

Technical User
Jul 5, 2001
27
CA
I am getting the following message: "could not find the object in the collection corresponding to the name or ordinal". How do I see what objects I have in a collection?

Thanks
Pat
 
Of course, it depends on what collection you are using.

Here is the general format with an example of the Users and Groups collections.

Dim cg As New ADOX.Catalog
Set cg.ActiveConnection = CurrentProject.Connection

Dim ur As User, gp As Group
For Each ur In cg.Users
Debug.Print "Users = "; ur.Name

For Each gp In ur.Groups
Debug.Print " Group = "; gp.Name

Next
Next
 
Here's another example for Controls on a form:

Dim cntl As Control

For Each cntl In Me.Controls
Debug.Print cntl.name
Next cntl

If you browse the me object in view locals debug pane, you will find other things you may want to see.

Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top