Automatically Set Checkbox value based on a combo box value

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi,

I was wondering if anyone knows how I can go about getting
a checkbox in a form to automatically set to either -1 or
0 based on a value that I choose in a combo box on the
same form. In other words I would like to set the
checkbox value to -1 if I choose one of the values in my
combo box but set it to 0 if I choose any of the other
values in the combo box. The Row source for the combo box
does not lookup to a table but is a list I typed into the
combo box properties under row source. I am able to set
the default value for the checkbox to -1 but cannot figure
out how to build the logic for it to look at the combo box
value to determine whether the checkbox value should be -1
or 0 based on the selection I chose from the combo box.

Any help would be appreciated.
Thx.
 
In the AfterUpdate event of the combo box and the OnCurrent event of the form set the
value of the checkbox.

Example:
Select Case Me.cboMyCombo
Case "FirstValue", "SecondValue"
Me.chkMyCheckbox = True
Case Else
Me.chkMyCheckbox = False
End Select

If the values of the combo box are numbers instead of text, remove the quotes.
 
Back
Top