okay, here's a solution. the code's not too bad, but the explanation will be
a bit lengthy, so sit back and get comfortable...
first, identify two "paired" groups of controls that you want to manipulate
in tandem. in the first group of controls, set each control's Tag property
to "A" (without the quote marks). in the second group, set each control's
Tag property to "B" (again sans quote marks).
paste the following custom procedure into the form's module, as
Private Sub ResetGroup(ByVal strCurGroup As String, ByVal str As String)
Dim ctrl As Control, bln As Boolean
bln = True
For Each ctrl In Me.Controls
If ctrl.Tag = strCurGroup Then
If TypeOf ctrl Is CheckBox Then
If ctrl = True Then
bln = False
Exit For
End If
ElseIf Not IsNull(ctrl) Then
bln = False
Exit For
End If
End If
Next ctrl
For Each ctrl In Me.Controls
If ctrl.Tag = str Then
ctrl.Enabled = bln
End If
Next ctrl
End Sub
in the AfterUpdate event procedure of each control in group A, add the
following code, as
ResetGroup Me.Tag, "B"
in the AfterUpdate event procedure of each control in group B, add the
following code, as
ResetGroup Me.Tag, "A"
in the form's Current event procedure, add the following code, as
Dim colGroups As New Collection
colGroups.Add Array("A", "B")
colGroups.Add Array("B", "A")
Dim var As Variant
For Each var In colGroups
ResetGroup var(0), var(1)
Next var
notice how the code directly above adds two elements to the collection, for
the "paired groups": Array("A", "B") AND Array("B", "A").
now identify the next two "paired groups"; let's call them "C" and "D". set
the Tag property of each control in the first group to C, and the Tag
property of each control in the second group to D. you'll need to add code
to the form's Current event, to add two *additional* elements to the
collection, immediately below the first two elements, as
colGroups.Add Array("C", "D")
colGroups.Add Array("D", "C")
in the AfterUpdate event procedure of each control in group C, add the
following code, as
ResetGroup Me.Tag, "D"
in the AfterUpdate event procedure of each control in group D, add the
following code, as
ResetGroup Me.Tag, "C"
continue identifying each group you want to manipulate in tandem, and
setting them up as explained above. note that a group can be all textboxes,
all checkboxes, or a combination of the two (the code should work on
combobox controls too - though i didn't test it specifically - and *maybe*
on option group controls - didn't test that either.)
also note that the Tag value can more than one letter, if you want - such as
"Group1" and "Group2", or whatever - just make sure you reference the
correct Tag value throughout the code.
hth