The Documents collection gives you the name of each form, but you then have
to OpenForm before you can get at the controls and their properties.
In Access 2000 and later, it might be easier to use the AllForms collection.
For an example of that approach, opening each form hidden, looping through
its controls, and closing the form again. see:
http://allenbrowne.com/ser-46.html
The example has a bit more complexity than you need, because it is actually
making changes to work around an A2003 problem where the form flickers, but
it shows the approach.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Jozef" <me@you.com> wrote in message
news:unHZe.556288$s54.379950@pd7tw2no...
Hello,
I'm trying to loop through forms by doing a "For Each" in the Currentdb.
I'm doing this like the following;
Dim db as dao.database
Dim docLoop as document
Dim ctrl as control
Set db = CurrentDb
With db.Containers!Forms
For Each docloop In .Documents
'Code to set the form here
'set frm = db.containers.whatever (not sure how to do this, hence
the question)
For each ctrl in frm.controls
ctrl.backcolor = 16777215
Next ctrl
Next docloop
End With
This is kind of air code, but you should get the idea. The step I'm
missing is converting the Document to a Form object.
Any ideas?
Thanks!