loop thru "all:" forms in a current project

  • Thread starter Thread starter Mark Kubicki
  • Start date Start date
M

Mark Kubicki

I would like to loop thru all of the forms in a current project (whether the
forms are open, loaded or not) (and change the background color of the formm
header to a public constant.)

It seems as though the "forms" collection only accesses those that are open.

how would I access "all" form?


thanks in advance,
mark
 
Here is a sample routine that loops through all the forms in an mdb:

Public Sub ShowForms()
Dim frm As Object

For Each frm In CurrentProject.AllForms
'You code goes here
Debug.Print frm.Name
Next frm
End Sub

Note, to make the changes, you will need to open the form in design view (it
can also be hidden), make the changes and close the form and save it. it
would be like

docmd.Close acForm, strFormName, acSaveYes
 
Back
Top