Home Page
Policies
Policies
About
Tips And Tricks
Helpful Links
e-mail me

Picture of building from outside Tips And Tricks

I seem to run into things from time to time that I want to share with the world, usually things that I had to find out the hard way. Sometimes it will just be something that I had to dig for, and want to make more readily accessible. This page is intended to make life a little easier for other programmers. If it meets your need, then that's what it's here for.



Enumerate MS Access Form Names

I had created a page on the site with an example of enumerating project properties, and it seemed like people were searching for ways to enumerate other things, and found my site. Well, it occurred to me that it would be advantageous to be able to enumerate some other things anyway. We all have those times when we need to be able to get counts or lists of various items in a project or database, like that time that I was explaining the project to a consultant that the customer hired.
'produce a list of form names in the current project -BWM 10-26-09
'returns correct list even when called through a reference
Function EnumerateForms()
 On Error GoTo Err_EnumerateForms
 Dim idx As Long
 
 For idx = 0 To CurrentProject.AllForms.Count - 1
  Debug.Print CurrentProject.AllForms(idx).Name
 Next
 
Exit_EnumerateForms:
 Exit Function

Err_EnumerateForms:
 MsgBox "Error #" & Err.Number & ": " & Err.Description
 Resume Exit_EnumerateForms
End Function

I have tested this in Access 2000, in both ADPs and MDBs, and in my tests, it seemed to work in both. When I wrote this, I used portions of a program which had been created to read our source code and gather statistics on it.


If you found this information to be useful, and would like to donate via PayPal to help offset the cost of maintaining this web site, use the following button:



|Home Page| |Custom Software| |Policies| |About| |Tips And Tricks| |Helpful Links|