Tick Box control

mike30x

Registered User.
Local time
Today, 16:42
Joined
Apr 16, 2008
Messages
35
I have a row of tick boxes, i want only one to be selectable at any one time, how do i go about setting this up?:cool:
 
Why not use an option group instead? This has the functionality you want as standard.
 
Thanks Neil, I have already set them up as yes/no in Tables - how do i adjust them to be option buttons without altering this?

Thanks again
 
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
 
Last edited:
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

There is always more than 1 way to skin a cat but there is usually only one best way to skin a cat :D:D
 
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.
 

Users who are viewing this thread

Back
Top Bottom