Get list of the controls on a closed form

S

Steve

What is the code to create a list of the controls on a closed form in the
current database?

Thanks!

Steve
 
L

lyle fairfield

What is the code to create a list of the controls on a closed form in the
current database?

Thanks!

Steve

Save the form as text. Parse the text file. Piece of cake. I'd do it
if I could think of any use for it at all. But I can't.
 
M

MikeB

What is the code to create a list of the controls on a closed form in the
current database?

Thanks!

Steve

Not quite the answer you asked for but might this work?

If you were to open the form from a program, but set it as hidden,
then you would be able to get an object with a collection of all the
controls. Once you have gotten from that what you want (made a list,
whatever) you could close the form?
 
J

John W. Vinson

What is the code to create a list of the controls on a closed form in the
current database?

Thanks!

Steve

Depending on your version of Access, see the documentation on the AllForms
collection in VBA help.
 
T

Tony Toews [MVP]

MikeB said:
If you were to open the form from a program, but set it as hidden,
then you would be able to get an object with a collection of all the
controls. Once you have gotten from that what you want (made a list,
whatever) you could close the form?

Trouble is some forms may have external dependencies such as a combo box query based
on another form. That will likely cause an error message to come up when the form
opens that you can't get around.

Thus open the form in design view.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
M

Marshall Barton

John said:
Depending on your version of Access, see the documentation on the AllForms
collection in VBA help.


But an AccessObject does not have a Controls collection.
For this purpose AllForms is no more useful than
Containers!Forms.Documents.
 
J

John W. Vinson

But an AccessObject does not have a Controls collection.
For this purpose AllForms is no more useful than
Containers!Forms.Documents.

oops... sorry, you're right of course, Marshall! Sorry for jumping in without
investigating further.
 
Top