Options Group Coding Question

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I'm using Access 2000 & I have a form that has both a drop down box with two
specific choices and later an options group with three selections.

What I want is if I selection the first selection from the drop down box to
ghost out the third item in the option box. Is this possible?

Any help would be appreciated.
 
Yes, it is. In the AfterUpdate event of the combo box and possible the
Current Event of the form, you would check the value of the combo box and
disable or enable the option control.

Example:
Me.optOptionButton.Enabled = Not (Me.cboCombobox = "My Value")

The part in the parenthesis will return True or False, the Not will reverse
this value and apply it to the Enabled property of the option button or
check box that you are using in the Option Group. Remember that the Value of
the combo box is the value in the bound column, which may not be the visible
column. Also, if the value is a number instead of text, remove the quotes.
 
AfterUpdate event on the combobox,

if me.mycombobox = "whatever the 1st one is" then_
me.OptionGroupThirdChoice.enabled = false

hth
blm
 
Thanks for the help! That worked perfectly!!!

I have one more question related to this. How can I now get the combo box
to be disabled with that option is selected from the Option Group? Since I
am now able to prevent them from selecting the wrong option item I want to
make sure that they cannot manipulate the situation by going back & changing
the combo box after the fact.

Again, I really appreciate the help!
 
Dave,

You're going to need to word this one a little better. I don't know which
option in the option box you want to select in order to disable the combo
box.
 
Let me see if I can explain this better.

I'll create this example.

In the Combo Box I have two options. Basketball; Football

In the Options Group I have three items. Scoring; Teams; Touchdowns

The formula that you provided me allowed me to disable or ghost out
"Touchdowns" when I select "Basketball" however I have found that I can
originally select "Football" and then go down & select "Touchdowns" and then
go back & change the first box back to "Basketball" and then the report will
list a basketball game with touchdowns which obviously makes no sense.

One last note, I have the form setup so that "Basketball" is the default
option because it's the used frequently and I'd like to keep it so that the
user can go back & update that option if they need to. I would just like to
make it so that if "Touchdowns" is selected that "Basketball" becomes an
invalid selection in the Combo Box.

Thanks again for your help!
 
Ok, I can follow what you're doing now. There are a couple of ways to do
this. The first one would be as you mentioned, block choosing Basketball if
Touchdowns is selected. The other would be to undo the Touchdowns selection
if Basketball is chosen.

1) In the combo box's BeforeUpdate event check the value of the option
group. If Touchdowns is selected, pop-up a message box warning the user of
the problem, set Cancel = True, and Me.cboMyCombo.Undo.

2) In the combo box's BeforeUpdate event check the value of the option
group. If Touchdowns is selected, pop-up a message box waring the user of
the problem and set the option group = Null or one of the other two values.
 
Back
Top