Getting names of ALL forms in database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sorry to ask this aged old question again:

In previous versions of Access, it is only possible to retrieve property
info on opened or loaded forms, not unloaded forms. Is it still the same for
Access 2003? If so, can anyone suggest a method to retrieve info on unloaded
forms?

The reason I asked is that I want to write a form where user can define a
descriptive name for a pre-defined form, and that descriptive name would
appear on a main menu, so anyone who clicks on the name would open the said
form. This method seems more dynamic than hardcoding the form's name in the
menu, as well as allowing new forms to be added anytime.

Any suggestions welcomed.
 
Please ignore this question, as I just found out how -
currentproject.allforms.item(i).name.

Sorry for the trouble... :)
 
That is similar to the method used in the "switchboard" or menu form in the
Microsoft demo databases. You can simply build a table and put all the
formnames in it, then add a friendly name column and use a list box to
select/open the form. Here's some code that will get you a list of form
names which you can then write to a table:

Dim db As DAO.Database
Dim i As Integer
Dim contr As DAO.Container
Dim strFormList As String
Dim StrFormName As String
Dim Length As Integer

Set db = CurrentDb()
Set contr = db.Containers("Forms")

strFormList = ""
For i = 0 To contr.Documents.Count - 1
StrFormName = contr.Documents(i).name
If strFormList <> "" Then strFormList = strFormList & ";"
Length = Len(StrFormName)
strFormList = strFormList & StrFormName
Next i
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top