Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Object Collections

3 views
Skip to first unread message

Martin Dashper

unread,
Jun 23, 2004, 10:02:18 AM6/23/04
to
I want to create a collection, if possible, to contain a group of
checkboxes in order to perform operations on them all at once.
Is this possible, and, if so, how?

Martin Dashper

JohnFol

unread,
Jun 23, 2004, 10:19:55 AM6/23/04
to
Yes it is, but it's not clear if these exist on a form or purely within
code.

What you may want to consider if this is a form is to set the .Tag property
to identify the collection. You can then enumerate the controls on the form
looking for the tag and then perform the opperation.


"Martin Dashper" <m.h.d...@uel.ac.uk> wrote in message
news:40d98c48.101441555@news...

Martin Dashper

unread,
Jun 23, 2004, 11:14:37 AM6/23/04
to
On Wed, 23 Jun 2004 15:19:55 +0100, "JohnFol" <Wib...@wobble.com>
wrote:

>Yes it is, but it's not clear if these exist on a form or purely within
>code.
>
>What you may want to consider if this is a form is to set the .Tag property
>to identify the collection. You can then enumerate the controls on the form
>looking for the tag and then perform the opperation.
>
>
>

I have several groups of checkboxes on a form and what I want to do is
control each group separately, for example, disable all the checkboxes
in a group at once.

Martin Dashper

PC Datasheet

unread,
Jun 23, 2004, 12:25:15 PM6/23/04
to
Martin,

Write a public function in your form module that performs the operations you
want for the checkboxes. Then select all the checkboxes, go to properties -
event tab amd enter the following:
=NameOfYourFunction

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
reso...@pcdatasheet.com
www.pcdatasheet.com


"Martin Dashper" <m.h.d...@uel.ac.uk> wrote in message
news:40d98c48.101441555@news...

Dirk Goldgar

unread,
Jun 23, 2004, 1:20:52 PM6/23/04
to
"Martin Dashper" <m.h.d...@uel.ac.uk> wrote in message
news:40d999e8.104928929@news

As JohnFol suggested, I use the Tag property for that. For example, I
might have some controls with their tags set to A, and some with their
tags set to B. Then I'd have code like this:

'----- start of code -----
Public Sub EnableControlGroup( _
frm As Access.Form, _
GroupID As String, _
YesOrNo As Boolean)

Dim ctl As Access.Control

For Each ctl in frm.Controls

If ctl.Tag = GroupID Then
ctl.Enabled = YesOrNo
End If

Next ctl

End Sub
'----- end of code -----

That would allow me to write, in code behind a form,

' Enable controls in group B.
EnableFormControls Me, "B", True
Me.SomeControlInB.SetFocus

' Disable controls in group A.
EnableFormControls Me, "A", False

A more elaborate version of the function would allow you to pass the
property you want to set for the group, and its value.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


0 new messages