GenuineGin
01-13-2015, 07:46 AM
Hello again (sorry for all the posts!)
I am having an issue with checkboxes this time. So far I have managed to get the code to count the number of checkboxes selected like so:
'Find out how many checkboxes have been checked
Dim ctl As Control
Dim j As Long
For Each ctl In Me.frameSurveyed.Controls
If TypeOf ctl Is MSForms.CheckBox Then
If Me.Controls(ctl.Name).Value = True Then
j = j + 1
End If
End If
Next
What I would now like to do is, if only one checkbox is selected in 'frameSurveyed', for the caption of that checkbox to be applied to a label in another form. I can't work out how to incorporate this argument into an if statement (tried 'If j = 1 Then...' but that didn't work, it applies to anything more than one) or how to specifically reference the selected checkbox.
Any help much appreciated!
I am having an issue with checkboxes this time. So far I have managed to get the code to count the number of checkboxes selected like so:
'Find out how many checkboxes have been checked
Dim ctl As Control
Dim j As Long
For Each ctl In Me.frameSurveyed.Controls
If TypeOf ctl Is MSForms.CheckBox Then
If Me.Controls(ctl.Name).Value = True Then
j = j + 1
End If
End If
Next
What I would now like to do is, if only one checkbox is selected in 'frameSurveyed', for the caption of that checkbox to be applied to a label in another form. I can't work out how to incorporate this argument into an if statement (tried 'If j = 1 Then...' but that didn't work, it applies to anything more than one) or how to specifically reference the selected checkbox.
Any help much appreciated!