access to controls on inactive forms

  • Thread starter Thread starter Daniel Pech
  • Start date Start date
D

Daniel Pech

Hi,

does anybody know how I can access controls on inactive forms? The catalog
AllForms doesn't work. With it I get an AccessObject, but no access to the
controls on it.
The Problem is, that I want to document all controls in my project.
Even I get the name of the form, but because it is only contained in a
variable, so I can't use the follow:

Forms!FormName. ...

It would be great if anybody has an idea!

Thanks in advanced

Daniel
 
I don't know ADO, but in DAO you would iterate the Forms >container< to get
the name of each form, then open the form in design view, then use the Forms
collection< to access its properties. Something like this:

(untested)

dim db as database, doc as document, frm as form, ctl as control
set db = currentdb()
for each doc in db.containers![Forms].documents
debug.print vbcr; doc.name
docmd.openform doc.name,,...,achidden ' <- check parameters!
set frm = Forms(doc.name)
for each ctl in frm.controls
debug.print vbtab; ctl.name
next
docmd.close acform, frm.name
set frm = nothing
next
set db = nothing

HTH,
TC
 
Hmm,
Second time I've read this. Light Finally dawned By Inactive, you mean
closed.
The Forms collection only applies to open forms.
You need to work through the DAO Hierarchy to find the form, open it
in design mode, document it then close it again.

You can use the structure

For each doc in container
dcmd.OpenForm doc.name,acDesign
' Now it is open you can use the Forms Collection to reference it
......
doc.d.Close, acForm, doc.Name
next doc

to do this recursively to document everything
 
Back
Top