<Travis.Box@gmail.com> wrote[color=blue]
>I have an MS Access userform with 16 Check Boxes. Each of the
> checkboxes has a different option value, which coincides with the Check
> Box name (eg. cb01.OptionValue = 1). At the bottom of the form is a
> command button. When the command button is clicked, I need the VBA
> scripting to determine which Check Box has been selected, and then
> assign a vaule to a string based on which Check Box has been selected.
> What I'm having trouble figuring out is what conditional statement to
> use in my "Select Case" statement to determine which of the Check Boxes
> have been selected.
>[/color]
[snip][color=blue]
> Does anyone have any suggestions on what conditional statement i should
> use, or what other process I could use to determine which of the Check
> Boxes have been checked?[/color]
You say that the checkboxes have an OptionValue, so that means they are
inside an OptionGroup frame. If that's not the case, I would suggest that
you put all of the checkboxes inside an option group frame (actually
probably easier to just create a new one). Then, all you will need to do is
check the value of the option frame, and that will return the value of the
checkbox you have selected.
Second, if what you have is only one possible check out of several values, I
would suggest that you use radio buttons instead, since this is more
consistent with the Windows UI. Generally, when you see several checkboxes
grouped together, the user should assume that he can select none, one, or
all.
To check the value of a checkbox outside a frame,
If Me.chkMyCheckBox then
'stuff
Endif
or
If Me.chkMyCheckBox = True then
'stuff
Endif
or
If Me.chkMyCheckBox.Value = True then
'stuff
Endif
If you have several checkboxes in a frame
--
Darryl Kerkeslager
Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See
www.adcritic.com/interactive/view.php?id=5927