Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / March 2005

Tip: Looking for answers? Try searching our database.

Group Controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Timboo - 04 Mar 2005 14:13 GMT
Hi, Just found that I can group objects on a form together.  But I could not
see how to refer to the group, once Id grouped the objects together.  For
example, rather than specifying the visibility property for each control upon
a button press, I thought Id group all the appropriate controls together and
then set the visibility property for the group as a whole.  But I cant see
how to refer to the group object.  Any ideas?
Thanks Tim
Sandra Daigle - 04 Mar 2005 16:04 GMT
Unfortunately, grouping doesn't provide this functionality.  A common work
around is to group the controls either by using a common prefix for the name
or by using a special keyword in the tag property of each control that is a
member of the group. Using either of these methods you can then loop through
the controls
to do whatever you require.

Method 1
-------------------
dim ctl as control
for each ctl in me.controls
   if  left(ctl.name,9)="ctlGroupA" then
           'do something
   endif
next ctl
set ctl=nothing

Method 2
----------------
dim ctl as control
for each ctl in me.controls
   if ctl.tag="GroupA" then
       'do something
   endif
next ctl
set ctl=nothing

Method 3
--------------
This works if you name your controls with a common prefix and a number
(txtGroupA1, txtGroupA2 . . txtGroupA9)

dim i as integer
for i=1 to 9
   'do something to the  control
   debug.print i,   me.controls("txtGroupA" & i).value
next i

Method 4
--------------
Take a look at my website for some custom classes that provide methods for
working with groups of controls:
It's the ControlGroups sample on www.daiglenet.com/msaccess.htm

Signature

Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

> Hi, Just found that I can group objects on a form together.  But I
> could not see how to refer to the group, once Id grouped the objects
[quoted text clipped - 4 lines]
> the group object.  Any ideas?
> Thanks Tim
Timboo - 07 Mar 2005 11:07 GMT
Sandra, Thank you, I will give method 2 a go.  Tim.

> Unfortunately, grouping doesn't provide this functionality.  A common work
> around is to group the controls either by using a common prefix for the name
[quoted text clipped - 48 lines]
> > the group object.  Any ideas?
> > Thanks Tim
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.