dbTalk Databases Forums  

Get list of the controls on a closed form

comp.databases.ms-access comp.databases.ms-access


Discuss Get list of the controls on a closed form in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Steve
 
Posts: n/a

Default Get list of the controls on a closed form - 10-11-2008 , 04:52 PM






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

Thanks!

Steve



Reply With Quote
  #2  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-11-2008 , 06:27 PM






On Sat, 11 Oct 2008 17:52:16 -0400, "Steve" <nonsense (AT) nomsense (DOT) com>
wrote:

There is no easy way to do that.

-Tom.
Microsoft Access MVP


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

Thanks!

Steve


Reply With Quote
  #3  
Old   
Steve
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-11-2008 , 06:43 PM



Thanks for responding, Tom!

What is the hard way?

Steve


"Tom van Stiphout" <tom7744.no.spam (AT) cox (DOT) net> wrote

Quote:
On Sat, 11 Oct 2008 17:52:16 -0400, "Steve" <nonsense (AT) nomsense (DOT) com
wrote:

There is no easy way to do that.

-Tom.
Microsoft Access MVP


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

Thanks!

Steve




Reply With Quote
  #4  
Old   
Tony Toews [MVP]
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-11-2008 , 07:45 PM



"Steve" <nonsense (AT) nomsense (DOT) com> wrote:

Quote:
Thanks for responding, Tom!

What is the hard way?
You open the form in design view. However that only works for MDBs. You can see
Rick Fisher's Find and Replace work this way.

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/


Reply With Quote
  #5  
Old   
Steve
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-11-2008 , 07:57 PM



Thanks for responding, Tony!

What is the code for getting the list of the controls once you have the form
open in design view? You can't use:
For each Ctl In Forms("MyForm").Controls
because the Forms collection doesn't exist when no forms are open.

Further, If whatever you know works for MDBs, does it work for ACCDBs?

Steve



"Tony Toews [MVP]" <ttoews (AT) telusplanet (DOT) net> wrote

Quote:
"Steve" <nonsense (AT) nomsense (DOT) com> wrote:

Thanks for responding, Tom!

What is the hard way?

You open the form in design view. However that only works for MDBs. You
can see
Rick Fisher's Find and Replace work this way.

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/



Reply With Quote
  #6  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-11-2008 , 08:14 PM



On Sat, 11 Oct 2008 20:57:42 -0400, "Steve" <nonsense (AT) nomsense (DOT) com>
wrote:

Why would it NOT work in accdb? That's about database storage, not the
forms package.

Dim ctl As Control
Dim strFormName As String

strFormName = "_test1"
DoCmd.OpenForm strFormName, acDesign
For Each ctl In Forms(strFormName)
Debug.Print ctl.Name
Next
DoCmd.Close acForm, strFormName

-Tom.
Microsoft Access MVP



Quote:
Thanks for responding, Tony!

What is the code for getting the list of the controls once you have the form
open in design view? You can't use:
For each Ctl In Forms("MyForm").Controls
because the Forms collection doesn't exist when no forms are open.

Further, If whatever you know works for MDBs, does it work for ACCDBs?

Steve



"Tony Toews [MVP]" <ttoews (AT) telusplanet (DOT) net> wrote in message
news:t3i2f4tbb907tf5jqhhg7luf9i9qbanmh2 (AT) 4ax (DOT) com...
"Steve" <nonsense (AT) nomsense (DOT) com> wrote:

Thanks for responding, Tom!

What is the hard way?

You open the form in design view. However that only works for MDBs. You
can see
Rick Fisher's Find and Replace work this way.

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/


Reply With Quote
  #7  
Old   
lyle fairfield
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-11-2008 , 09:12 PM



On Oct 11, 5:52*pm, "Steve" <nonse... (AT) nomsense (DOT) com> wrote:
Quote:
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.


Reply With Quote
  #8  
Old   
MikeB
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-12-2008 , 01:49 AM



On Oct 11, 4:52 pm, "Steve" <nonse... (AT) nomsense (DOT) com> wrote:
Quote:
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?


Reply With Quote
  #9  
Old   
John W. Vinson
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-12-2008 , 02:45 PM



On Sat, 11 Oct 2008 17:52:16 -0400, "Steve" <nonsense (AT) nomsense (DOT) com> wrote:

Quote:
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.
--

John W. Vinson [MVP]


Reply With Quote
  #10  
Old   
Tony Toews [MVP]
 
Posts: n/a

Default Re: Get list of the controls on a closed form - 10-12-2008 , 03:53 PM



MikeB <MPBrede (AT) gmail (DOT) com> wrote:

Quote:
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/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.