CheckBox populate by Listbox ???

  • Thread starter Thread starter If
  • Start date Start date
I

If

Good evening,

I would like activated a check box (CheckYesNo) if a value is selected in a
drop-down list (cmbList).

I tested this but...

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = True
End Sub

et ceci

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = "Yes"
End Sub

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = "-1"
End Sub

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = "1"
End Sub


Thank you in advance for your assistance.


Yves
 
I would like activated a check box (CheckYesNo)
if a value is selected in a drop-down list (cmbList).

I tested this but...

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = True
End Sub

et ceci

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = "Yes"
End Sub

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = "-1"
End Sub

Private Sub cmbList_AfterUpdate()
Me.CheckYesNo.Value = "1"
End Sub

Yves

You need to tell it what was selected, if anything:
***************************************************

1) If you want the checkbox activated regardless of what
was selected, then:

Private Sub cmbList_AfterUpdate()
If IsNull(Me.cmbList).Value Then
Me.CheckYesNo.Value = False
Else
Me.CheckYesNo.Value = True
End If
End Sub

2) If you have something specific in mind, and cmbList stores a string:

Private Sub cmbList_AfterUpdate()
If Me.cmbList.Value = "red" Then
Me.CheckYesNo.Value = True
Else
Me.CheckYesNo.Value = False
End If
End Sub

3) If you have something specific in mind, and cmbList stores a number:

Private Sub cmbList_AfterUpdate()
If Me.cmbList.Value = 1 Then
Me.CheckYesNo.Value = True
Else
Me.CheckYesNo.Value = False
End If
End Sub

***************************************************
- Kurt
 
It looks like what you want to do is populate the check box, if any value is
selected in the combo box. In which case, I would use:

Private Sub cmbList_AfterUpdate()

Me.CheckYesNo = NOT IsNull(Me.cmbList)

End Sub

HTH
Dale
 
Back
Top