> By don't work, I mean that I do not get a list. Each option group only
> includes two possibilities. The values for each choice is a 1 or a 2. I
[quoted text clipped - 68 lines]
>> >> >> form.
>> >> >> Tyra Horner
The field and option group are related in several ways. First the option
selection is stored in its related field. Second the option group label is
the same as the field name. So if the list is populated with the option group
label for each option group where option two is selected, that would work.
On a related note, how do I link the module to the form. It seems to have
some difficulty connecting.
The form looks something like this.
1.1 Proper Labeling 1 2
1.2 Current 1 2
1.3 Proper Dilution 1 2
Instead of ones and twos there are checkboxes.
Tyra Horner
> Can you tell me how the "field" and the "option group" are related? In other
> words, if the code finds that an option group control has a value of 2,
[quoted text clipped - 76 lines]
> >> >> >> form.
> >> >> >> Tyra Horner
Ken Snell [MVP] - 19 Oct 2005 14:14 GMT
Linking the module to the form? You should have this code in the form's
module, not in a separate module. If you want to put this code in a public
subroutine, you'll need to pass a variable object for the form to it so that
it can be used. For now, what I'm providing is an example of how the code
would be in the form's module.
OK - so what you want is to get the value of the field whose name is in the
label with the option group's value. A bit tricky, but this code should get
us started. What this code does is "crawl" through all the form's controls;
when it finds an option button, it tests the Option Value of that button
against the value of the option group to which it belongs; if they match and
the value is 2, the code reads the caption of the label that is attached to
the option button and then reads the value of the field from the form's
recordset and puts it into the value list string. When done, the value list
is assigned to the combo box.
Dim strValueList As String, strValue As String
Dim ctl As Control
strValueList = ""
For Each ctl In Me.Controls
If ctl.ControlType = acOptionButton Then
If ctl.OptionValue = ctl.Parent.Value And ctl.OptionValue = 2 Then
strValue = Me.Recordset.Fields(ctl.Controls(0).Caption).Value
strValueList = strValueList & strValue & ";"
End If
End If
Next ctl
If strValueList <> "" Then
strValueList = Left(strVL, Len(strVL) - 1)
Me.Combo229.RowSourceType = "Value List"
Me.Combo229.RowSource = strValueList
End If

Signature
Ken Snell
<MS ACCESS MVP>
> The field and option group are related in several ways. First the option
> selection is stored in its related field. Second the option group label is
[quoted text clipped - 11 lines]
> Instead of ones and twos there are checkboxes.
> Tyra Horner