This seems like it should be easy, but none of the methods I’ve tried have worked.
I have two option boxes (optYES and optNO as a response to the question “Is the building sprinklered?”). Then I have a combo box (cmbOccupancyGroup) and a label (lblTravelDistance). From the combo box, I would choose one of 26 options. Depending on the selection from the combo box and the YES/NO option (whether the building is sprinklered or not), the answer in lblTravelDistance will vary. I can get my code to choose and display one of the 26 options from the combo box, and I can get it to pass the correct value in lblTravelDistance when optYES is clicked. But I anticipate that someone may 1) forget to choose YES or NO, or 2) choose YES when they meant to choose NO and vice versa. So I want the value in lblTravelDistance to change depending on whether optYES or optNO is selected, and to go back and forth if the selection goes back and forth. Right now, that doesn’t work – the values don’t change. Here’s my code (I tried it both of the ways shown, but neither works)…
(A1 is an occupancy group, not a cell)...
Private Sub cmbOccupancyGroup_Change()
If optYES.Value = True And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "250"
ElseIf optYES.Value = False And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "200"
End If
If optYES.Value = True And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "250"
ElseIf optNO.Value = True And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "200"
End If
Do you see something here?
Larry
I have two option boxes (optYES and optNO as a response to the question “Is the building sprinklered?”). Then I have a combo box (cmbOccupancyGroup) and a label (lblTravelDistance). From the combo box, I would choose one of 26 options. Depending on the selection from the combo box and the YES/NO option (whether the building is sprinklered or not), the answer in lblTravelDistance will vary. I can get my code to choose and display one of the 26 options from the combo box, and I can get it to pass the correct value in lblTravelDistance when optYES is clicked. But I anticipate that someone may 1) forget to choose YES or NO, or 2) choose YES when they meant to choose NO and vice versa. So I want the value in lblTravelDistance to change depending on whether optYES or optNO is selected, and to go back and forth if the selection goes back and forth. Right now, that doesn’t work – the values don’t change. Here’s my code (I tried it both of the ways shown, but neither works)…
(A1 is an occupancy group, not a cell)...
Private Sub cmbOccupancyGroup_Change()
If optYES.Value = True And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "250"
ElseIf optYES.Value = False And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "200"
End If
If optYES.Value = True And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "250"
ElseIf optNO.Value = True And cmbOccupancyGroup.Value = "A1" Then
lblTravelDistance.caption = "200"
End If
Do you see something here?
Larry