Martin Dashper
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...
>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
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...
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)