how to know which one is selected?

M

Min

1) I've put three radio buttons in a frame, but I cannot find the way to
tell which radio button has been selected. I cannot find something like:
"radio1.selected = true"

2) Same problem for multi-choice boxes. On a form I have some multi-choice
boxes, How can I know which one is ticked, which one is not? I cannot find
something like:
"ckShowActive.ticked = true"

Anyone can help?
 
D

Dirk Goldgar

Min said:
1) I've put three radio buttons in a frame, but I cannot find the way
to tell which radio button has been selected. I cannot find something
like: "radio1.selected = true"

If the radio buttons are really part of the option group represented by
the frame, then the value of the option frame itself tells you which
radio button is currently "on". Each such button has an OptionValue
property, which is what the value of the frame will be when that button
is selected.

Note that it is possible to have standalone radio buttons, and it is
even possible to move such a button so that it appears to be inside the
option frame without actually being part of the option group. That can
be confusing.
2) Same problem for multi-choice boxes. On a form I have some
multi-choice boxes, How can I know which one is ticked, which one is
not? I cannot find something like:
"ckShowActive.ticked = true"

Anyone can help?

I'm not sure what you mean by a "multi-choice box". You'll have to
explain.
 
M

Min

Thanks for your reply!

If I did not misunderstand, to find the status of the option radio button is
actual check the frame's value see if it equates the value of the selected
option button, am I right? I'll check this later.

The multi-choice box is the check box, as it allows multi-select more than
one. Now, there is no frame for these check boxes, so, where to find if it
is ticked or not?
thank you!
Min
 
D

Dirk Goldgar

Min said:
Thanks for your reply!

If I did not misunderstand, to find the status of the option radio
button is actual check the frame's value see if it equates the value
of the selected option button, am I right? I'll check this later.

Right. If radio buttons, toggle buttons, or check boxes are made part
of an option group, then those controls have no Value property of their
own. Instead, the option *frame's* Value property reflects which of the
mutually exclusive option controls is selected.

Typically, in code one checks for the possible values of the option
frame using code like this:

Select Case Me!optMyGroup
Case 1 ' option 1 was chosen
' ...
Case 2 ' option 1 was chosen
' ...
Case 3 ' option 1 was chosen
' ...
Case Else ' no option was chosen
' ...
End Select
The multi-choice box is the check box, as it allows multi-select more
than one. Now, there is no frame for these check boxes, so, where to
find if it is ticked or not?

If a check box, radio button, or toggle button is placed on a form and
not made part of an option group, then the control does have a Value
property, which will be True (-1) if the control is
checked/ticked/"pushed" and False (0) if the control is
un-checked/un-ticked/"popped".

Typically, one checks a set of mutually independent check boxes (or
other binary-valued controls) using code like this:

If Me!chkChoice1 = True Then
' ... act on choice 1 ...
End If

If Me!chkChoice2 = True Then
' ... act on choice 2 ...
End If

If Me!chkChoice3 = True Then
' ... act on choice 3 ...
End If

Be aware that, in some cases, check boxes can be TripleState, in which
case they may actually have three values: True, False, and Null (which
isn't really a value, but rather the absence of a value).
 
A

Anne

Each button in a frame has an option value property. Use it to know if
the button has been selected.
for instance:
If Frm = 1 Then
or use a select case:
select case frm
case 1

case 2

end select

Anne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top