Simple radio button question...

NewShoes

Registered User.
Local time
Today, 12:01
Joined
Aug 1, 2009
Messages
223
Hey all,

Basically, I have 2 radio buttons A and B. These are bound to 2 fields within my table. What I need then to do is that whenever B is ticked, A shouldn't be and whenever A is ticked, B shouldnt be.

In simple terms, only one should be ticked at any one time.

This sounds easy but is causing me problems :(

Many thanks,
NS
 
Hey all,

Basically, I have 2 radio buttons A and B. These are bound to 2 fields within my table. What I need then to do is that whenever B is ticked, A shouldn't be and whenever A is ticked, B shouldnt be.

In simple terms, only one should be ticked at any one time.

This sounds easy but is causing me problems :(

Many thanks,
NS

i think if you put them in an option group with a frame around it, you'll get this done automatically
 
Thanks for the reply! Do you know how I would create an option group?

Thanks,
NS
 
it is one of the form controls in the toolbox when youre in design view
 
Thanks. I have just tried this I've found that it's not what I really need.

What I now need is two tick boxes (not radio buttons) of which only one can be ticked at one time (but sometimes neither will be ticked...which is why I couldnt use radio buttons)

Any help is really appreciated :)

NS
 
There are only three states to manage:

Both unticked
A Ticked
B Ticked

ie one field could be 0/1/2

Simon
 
While Option Groups facilitate this kind of thing, two checkboxes are really not difficult to handle:
Code:
Private Sub CheckBoxA_AfterUpdate()
 If Me.CheckBoxA = -1 Then Me.CheckBoxB = 0
End Sub

Private Sub CheckBoxB_AfterUpdate()
 If Me.CheckBoxB = -1 Then Me.CheckBoxA = 0
End Sub
This allows only one to be ticked at a time, or neither to be ticked, which I think was your requirement.
 
Thanks for the code missinglinq! However, I have the fields which the tick boxes are bound to set as Yes/No...will your code still work?

Thanks,
NS
 
Yes it will! In Boolean fields -1/0 is the same as Yes/No and True/False.
 
Great, thanks!

I'm guessing the -1 is the same as Yes and 0 is the same as No?

Thanks,
NS
 
While Option Groups facilitate this kind of thing, two checkboxes are really not difficult to handle:
Code:
Private Sub CheckBoxA_AfterUpdate()
 If Me.CheckBoxA = -1 Then Me.CheckBoxB = 0
End Sub

Private Sub CheckBoxB_AfterUpdate()
 If Me.CheckBoxB = -1 Then Me.CheckBoxA = 0
End Sub
This allows only one to be ticked at a time, or neither to be ticked, which I think was your requirement.

This worked great! Many thanks.

NS
 

Users who are viewing this thread

Back
Top Bottom