If you only ever have one option selected, you don't need multiple fields, just one field with a range of potential values. So you need to alter your design.
Neil's right! It's going to take wayyyyyyyy more time to write the code to make all of these controls behave in the manner you want than it will to delete them and use the Option Group Wizard. Here's the response I was writing while Neil answered you:
**************************************************************
You should have first created an Option Group. Using the wizard, you can choose the the type of control (checkbox, radio button) and then enter the caption for the label each one. Each option is assigned a value by the wizard. In the AfterUpdate event of the frame of the Option Group you can assign the code you want executed, like this:
Code:
Private Sub Frame0_AfterUpdate()
Select Case Frame0
Case 1
'Code for first button/checkbox
Case 2
'Code for second button/checkbox
End Select
End Sub
Neil's right! It's going to take wayyyyyyyy more time to write the code to make all of these controls behave in the manner you want than it will to delete them and use the Option Group Wizard. Here's the response I was writing while Neil answered you:
**************************************************************
You should have first created an Option Group. Using the wizard, you can choose the the type of control (checkbox, radio button) and then enter the caption for the label each one. Each option is assigned a value by the wizard. In the AfterUpdate event of the frame of the Option Group you can assign the code you want executed, like this:
Code:
Private Sub Frame0_AfterUpdate()
Select Case Frame0
Case 1
'Code for first button/checkbox
Case 2
'Code for second button/checkbox
End Select
End Sub
If you just have to keep your checkoxes, you'll have to use code like this, including an AfterUpdate event for every checkbox you have:
Code:
Private Sub Check1_AfterUpdate()
If Check1 Then
Me.Check2 = 0
Me.Check3 = 0
End If
End Sub
Private Sub Check2_AfterUpdate()
If Check2 Then
Me.Check1 = 0
Me.Check3 = 0
End If
End Sub
Private Sub Check3_AfterUpdate()
If Check3 Then
Me.Check1 = 0
Me.Check2 = 0
End If
End Sub
Thanks for all the info learning something new everyday. The option group is very handy i was wondering if it is possible to use the option group but to be able to tick more than one option at a time???
Thanks for all the info learning something new everyday. The option group is very handy i was wondering if it is possible to use the option group but to be able to tick more than one option at a time???
bThe Option Group will only allow you to tick one option at a time. If you want/need diferent you either have to split the options into groups if that is possible or use code similar to what Missinglinq posted.